40 行
2.0 KiB
PHP
可执行文件
40 行
2.0 KiB
PHP
可执行文件
<?php
|
|
namespace Common\Model;
|
|
/*门店采购应付款模型
|
|
*
|
|
*/
|
|
use Think\Model;
|
|
//[1.5.46]
|
|
class SPurchasePayableModel extends JBaseModel
|
|
{
|
|
protected $tableName='retail_store_purchase_payable';
|
|
const ID = 'id'; //int(11) NOT NULL AUTO_INCREMENT,
|
|
const MERCHANT_ID = 'merchant_id'; //int(11) DEFAULT '0' COMMENT '商户id',
|
|
const STORE_ID = 'store_id'; //int(11) DEFAULT '0' COMMENT '门店id',
|
|
const SUPPLIER_ID = 'supplier_id'; //int(11) DEFAULT '0' COMMENT '供货商id',
|
|
const PURCHASE_ORDER_ID = 'purchase_order_id'; //采购单id
|
|
const PURCHASE_ORDER_NUMBER = 'purchase_order_number'; //varchar(20) DEFAULT '' COMMENT '采购订单号',
|
|
const OPERATOR_ID = 'operator_id'; // int(11) DEFAULT '0' COMMENT '操作人id',
|
|
const PURCHASE_TIME = 'purchase_time'; //varchar(13) DEFAULT '' COMMENT '采购时间',
|
|
const PAYABLE_MONEY = 'payable_money'; //decimal(11,2) DEFAULT '0.00' COMMENT ' 应付金额',
|
|
const PAID_MONEY = 'paid_money'; //decimal(11,2) DEFAULT '0.00' COMMENT '已付金额',
|
|
const PAY_STATUS = 'pay_status'; //已作废
|
|
|
|
/**
|
|
* 寄售供货商增加应付金额
|
|
* @param $parameter[store_id=>门店id,supplier_json=>出库对应的商品来源,purchase_id_str=>采购id]
|
|
*/
|
|
public function addPayableMoney($parameter)
|
|
{
|
|
$store_id = $parameter['store_id'];
|
|
$supplier_json = $parameter['supplier_json'];
|
|
$purchase_id_str = $parameter['purchase_id_str'];
|
|
$purchase_id_str = explode(',',$parameter['purchase_id_str']);
|
|
if(!empty($purchase_id_str)){
|
|
foreach ($purchase_id_str as $val){
|
|
$payable_money = round($supplier_json[$val]['warehouse_price'] * $supplier_json[$val]['num'],2);
|
|
$this->updateSetInc(array('purchase_order_id'=>$val),"payable_money",$payable_money);
|
|
}
|
|
}
|
|
}
|
|
} |