$error = "错误:单据日期不能小于上月月结后本月开始日期"; } else { $allmoney = 0; $query = "select * from tb_inmoneylist where fd_inmylt_id = '{$listid}'"; $db->query($query); if ($db->nf()) { $db->next_record(); $allmoney = $db->f(fd_inmylt_money); $vclienttype = $db->f(fd_inmylt_type); $vclientid = $db->f(fd_inmylt_clientid); } //生成往来对帐单 $ctatmemo = "收款单收取" . $allmoney . "元"; $cactlisttype = "8"; $addmoney = 0; currentaccount($vclienttype, $vclientid, $addmoney, $allmoney, $ctatmemo, $cactlisttype, $loginstaname, $listid, $listno, $date); changemoney($vclienttype, $vclientid, $allmoney, 1); //修改应收应付款函数,0代表正,1代表负数 // changeaccount($accountid , $allmoney , 0); //调用修改帐户金额的函数 //生成帐户流水帐 $chgememo = "收款单收取" . $allmoney . "元"; $chgelisttype = "8"; $cogetype = 0; //0为收款 , 1为付款 cashglide($accountid, $allmoney, $chgememo, $chgelisttype, $loginstaname, $listid, $listno, $cogetype, $date); $query = "update tb_inmoneylist set fd_inmylt_state = 1 , fd_inmylt_datetime = now() \n where fd_inmylt_id = '{$listid}'"; $db->query($query); //修改付款单 require "../include/alledit.2.php"; Header("Location: {$gotourl}"); }
//获取刷卡器设备号 $paycardkey = getpaycardkey($paycardid); //商品流水帐 $cogememo = "销售商品类型为" . $productname . "的刷卡器设备:" . $paycardkey; $cogelisttype = "3"; $cogetype = 1; //0为增加 , 1为减少 commglide($storageid, $productid, $quantity, $cogememo, $cogelisttype, $loginstaname, $listid, $listno, $cogetype, $date); $allmoney += $price * $quantity; //销售总额 } //生成分行往来对帐单 $ctatmemo = "应收" . $cusname . "客户" . $allmoney . "元"; $cactlisttype = "3"; $lessenmoney = 0; currentaccount(1, $cusid, $allmoney, $lessenmoney, $ctatmemo, $cactlisttype, $loginstaname, $listid, $listno, $date); if ($allmoney != 0) { changemoney(1, $cusid, $allmoney, 0); //第四位0代表正,1代表负数 } //生成帐户流水帐 $chgememo = "销售单收取" . $cusname . "客户" . $allmoney . "元"; $chgelisttype = "3"; $cogetype = 0; //0为收款 , 1为付款 cashglide($accountid, $allmoney, $chgememo, $chgelisttype, $loginstaname, $listid, $listno, $cogetype, $date); $query = "insert into tb_cus_stock(\n\t fd_stock_no , fd_stock_date ,fd_stock_cusid , fd_stock_cusno,\n\t\t\t\t\tfd_stock_cusname ,\tfd_stock_skfs ,fd_stock_shaddress ,fd_stock_allmoney,\n\t\t\t\t\tfd_stock_allcost ,fd_stock_saleid ,fd_stock_datetime ,fd_stock_state\n\t )values(\n\t '{$listno}' , '{$date}' ,'{$cusid}' , '{$cusno}',\n\t\t\t\t\t'{$cusname}' , '{$skfs}' ,'{$shaddress}'\t , '{$allmoney}',\n \t\t\t\t\t'{$allmoney}' , '{$listid}' , now() , '1'\n\t )"; $db->query($query); //插入单据资料 $cus_listid = $db->insert_id(); //取出刚插入的记录的主关键值的id
$batches = $arr_data[$valeu]['batches']; $productscope = $arr_data[$valeu]['productscope']; $producttypeid = $arr_data[$valeu]['producttypeid']; $intlenght = strlen($arr_endint); for ($arr_startint; $arr_startint <= $arr_endint; $arr_startint++) { $arr_startint = $arr_startint + 0; $newdata = isbuzero($intlenght, $arr_startint); $paycardid = trim($arr_cart . $newdata); $query = "insert into tb_paycard(\n\t\t\t\t\t\t\t\t\t\tfd_paycard_key,fd_paycard_no,fd_paycard_product,fd_paycard_batches,fd_paycard_stockprice,\n\t\t\t\t\t \t fd_paycard_paycardtypeid ,fd_paycard_scope,fd_paycard_memo,fd_paycard_datetime,fd_paycard_state\n\t\t\t\t\t \t )values('{$paycardid}','{$paycardid}','{$productid}','{$batches}','{$price}','{$producttypeid}','{$productscope}',\n\t\t\t\t\t \t '{$date} 该刷卡器采购入库','{$date}','1'\n\t\t\t\t\t \t )"; $db->query($query); } } //生成分行往来对帐单 $ctatmemo = "应付" . $suppname . "供应商" . $allmoney . "元"; $cactlisttype = "1"; currentaccount(2, $suppid, '', $allmoney, $ctatmemo, $cactlisttype, $loginstaname, $listid, $listno, $date); changemoney(2, $suppid, $allmoney, 1); //0代表正,1代表负数 } $query = "update tb_paycardstock set\n\t fd_stock_state = 9 , fd_stock_datetime = now() \n\t where fd_stock_id = '{$listid}' "; $db->query($query); //修改单据资料 require "../include/alledit.2.php"; echo "<script>alert('审批成功!');location.href='{$gotourl}';</script>"; } break; case "dellist": //审批不通过 $query = "update tb_paycardstock set fd_stock_state ='0',fd_stock_memo='{$memo_z}' where fd_stock_id = '{$listid}' "; $db->query($query); //修改单据资料