function checkstorage($batches, $commid, $endquantity, $cost, $listid, $listno, $listtype, $memo) { $db = new DB_test(); $query = "select fd_sect_cost from tb_storagecost where fd_sect_commid = '{$commid}' "; $db->query($query); //查出机构的平均价格 if ($db->nf()) { $db->next_record(); $oldcost = $db->f(fd_sect_cost); //平均价格 } $query = "select sum(fd_skqy_quantity) as allquantity from tb_paycardstockquantity \n\t where fd_skqy_commid = '{$commid}' "; $db->query($query); //计算该机构或者配送中心的库存数量。 if ($db->nf()) { $db->next_record(); $oldquantity = $db->f(allquantity); $newquantity = $oldquantity + $endquantity; if ($newquantity == 0) { $newmoney = $oldcost * $oldquantity + $cost * $endquantity; } else { $newmoney = 0; } } else { $newmoney = 0; } if ($newmoney != 0) { $formermoney = $oldcost * $oldquantity; $aftermoney = $cost * $endquantity; $query = "insert into tb_intocompensatory (\n \t fd_iocy_date , fd_iocy_listid , fd_iocy_listtype , \n \t fd_iocy_paycardid , fd_iocy_formermoney , fd_iocy_aftermoney , \n \t fd_iocy_memo , fd_iocy_formercost , fd_iocy_aftercost ,\n \t fd_iocy_listno , fd_iocy_formerquantity , fd_iocy_afterquantity \n \t )values(\n \t now() , '{$listid}' , '{$listtype}' ,\n \t '{$paycardid}' , '{$formermoney}' , '{$aftermoney}' ,\n \t '{$memo}' , '{$oldcost}' , '{$cost}' ,\n \t '{$listno}' , '{$oldquantity}' , '{$endquantity}' \n\t\t\t\n \t )"; $db->query($query); } return $newmoney; }
function getmemkpFilepath($fcatid) { $db = new DB_test(); $query = "select * from tb_scategoty where fd_scat_fcatid='{$fcatid}'"; $db->query($query); if ($db->nf()) { while ($db->next_record()) { //没有上传显示空白 $arr_scatid[] = $db->f(fd_scat_id); $arr_fcatid[] = $db->f(fd_scat_fcatid); } } for ($i = 0; $i < count($arr_scatid); $i++) { $query = "select * from tb_category_list where fd_cat_scatid='{$arr_scatid[$i]}'"; $db->query($query); if ($db->nf()) { while ($db->next_record()) { $catid = $db->f(fd_cat_id); $filename = $db->f(fd_cat_name); $picname = $db->f(fd_cat_url); $thumrul = $db->f(fd_cat_thumurl); $display = $db->f(fd_cat_display); $arr_list[] = array("vid" => $catid, "scatid" => $arr_scatid[$i], "filename" => $filename, "picname" => $picname, "picurl" => $thumrul, "display" => $display); } } else { $arr_list[] = array("vid" => "", "scatid" => $arr_scatid[$i], "filename" => "", "picname" => "", "picurl" => "", "display" => ""); } } $returnarray = $arr_list; return $returnarray; }
function order_creat_fplist($listid) { $db = new DB_test(); $db2 = new DB_test(); $dberp = new DB_erp2(); //读取发票申请 $query = "select * from web_invoicesq \n\t left join tb_organmem on fd_organmem_id = fd_ivcsq_memberid\n\t where fd_ivcsq_id = '{$listid}'"; $db->query($query); if ($db->nf()) { $db->next_record(); $iecrid = $db->f(fd_ivcsq_fpcusid); $iecrno = $db->f(fd_ivcsq_fpcusno); $iecrname = $db->f(fd_ivcsq_fpcusname); $orderid = $db->f(fd_ivcsq_orderid); $fptype = $db->f(fd_ivcsq_fptype); $money = $db->f(fd_ivcsq_money); $memo = $db->f(fd_ivcsq_memo); $fpusename = $db->f(fd_organmem_comnpany); $fpuseid = $db->f(fd_ivcsq_memberid); if ($invoicetype == "普通发票") { $invoicetype = 1; } else { $invoicetype = 0; } $s_orderid = implode(",", explode("@@@", $orderid)); $query = "select * from web_order \n where fd_order_id in ({$s_orderid}) "; $db->query($query); if ($db->nf()) { $db->next_record(); $sdcrid = $db->f(fd_order_sdcrid); if ($sdcrid == 1) { $mscompanyid = 1; //广州市明盛物流有限公司 } else { if ($sdcrid == 2) { $mscompanyid = 4; //上海粤琳珠物流有限公司 } else { if ($sdcrid == 3) { $mscompanyid = 13; //廊坊市明盛纸业有限公司 } else { if ($sdcrid == 4) { $mscompanyid = 9; } else { if ($sdcrid == 5) { $mscompanyid = 11; } } } } } } $issue = date("Y", mktime()) . date("m", mktime()); $listno = listnumber_update(); $query = "insert into tb_invoiceapply(\n\t fd_ieay_listno , fd_ieay_iecrid , fd_ieay_iecrno ,\n\t fd_ieay_iecrname , fd_ieay_sporganid , fd_ieay_date , \n\t fd_ieay_mscompanyid , fd_ieay_issue , fd_ieay_staname ,\n\t fd_ieay_invoicetype , fd_ieay_sdcrid , fd_ieay_cporganid , \n\t fd_ieay_xjmoney , fd_ieay_yhmoney , fd_ieay_spsdcrid ,\n\t fd_ieay_memo , fd_ieay_dziecrid , fd_ieay_sqinvoicetype ,\n\t fd_ieay_sqmscid , fd_ieay_sqyhmoney , fd_ieay_sqxjmoney ,\n\t fd_ieay_websqid , fd_ieay_fpuseid , fd_ieay_fpusename\n\t )values(\n\t '{$listno}' , '{$iecrid}' , '{$iecrno}' ,\n\t '{$iecrname}' , '1' , now() ,\n\t '{$mscompanyid}' , '{$issue}' , '网站' ,\n\t '{$invoicetype}' , '{$sdcrid}' , '1' , \n\t '0' , '{$money}' , '{$sdcrid}' ,\n\t '{$memo}' , '{$iecrid}' , '{$invoicetype}' ,\n\t '{$mscompanyid}' , '0' , '{$money}' ,\n\t '{$listid}' , '{$fpuseid}' , '{$fpusename}'\n\t )"; $dberp->query($query); } }
function listnumber_update($listtype) { //global $loginorganno ; $db = new DB_test(); $query = "select * from tb_listnumber where fd_ltnr_typeid = '{$listtype}'"; $db->query($query); if ($db->nf()) { $db->next_record(); $tmp_listnumber = $db->f(fd_ltnr_design); $isdateauto = $db->f(fd_ltnr_isdateauto); //是否自动生成 $datetype = $db->f(fd_ltnr_datetype); //日期格式 $year = date("Y", mktime()); $month = date("m", mktime()); $day = date("d", mktime()); if ($isdateauto == 1) { $sqlwhere = " and fd_ltct_date = '{$year}-{$month}-{$day}' "; } else { $sqlwhere = " "; } $ltctcount = 1; $query = "select * from tb_listcount where fd_ltct_ltnrtypeid = '{$listtype}' {$sqlwhere} "; $db->query($query); if ($db->nf()) { $db->next_record(); $ltctcount = $db->f(fd_ltct_count) + 1; $ltctid = $db->f(fd_ltct_id); $query = "update tb_listcount set\n\t fd_ltct_count = fd_ltct_count+1\n\t where fd_ltct_id = '{$ltctid}' "; $db->query($query); } else { $query = "insert into tb_listcount(\n\t fd_ltct_count , fd_ltct_date , fd_ltct_ltnrtypeid\n\t )values(\n\t 1 , now() , '{$listtype}'\n\t )"; $db->query($query); } if ($ltctcount < 10) { $endltctcount = "00" . $ltctcount; } elseif ($ltctcount < 100 and $ltctcount >= 10) { $endltctcount = "0" . $ltctcount; } else { $endltctcount = $ltctcount; } if ($datetype == 1) { //全年份得日期格式 $tmp_listnumber = str_replace("{listno_date}", $year . $month . $day, $tmp_listnumber); } else { $endyear = substr($year, 2, 2); $tmp_listnumber = str_replace("{listno_date}", $endyear . $month . $day, $tmp_listnumber); } $listno = str_replace("{list_number}", $endltctcount, $tmp_listnumber); } return $listno; }
function changemoney($unittype, $clientid, $money, $type) { //$type =0表示应收 , 1表示应付 //$unittype = 2 表示供应商,1代表客户 //$clientid 往来单位id号 $db = new DB_test(); if ($type == 0) { $endmoney = $money; } else { $endmoney = -$money; } $query = "select * from tb_ysyfmoney where fd_ysyfm_type = '{$unittype}'\n\t and fd_ysyfm_companyid = '{$clientid}' "; $db->query($query); if ($db->nf()) { $db->next_record(); $oldmoney = $db->f(fd_ysyfm_money); $listid = $db->f(fd_ysyfm_id); $newmoney = $oldmoney + $endmoney; $query = "update tb_ysyfmoney set fd_ysyfm_money = '{$newmoney}'\n\t\t where fd_ysyfm_id = '{$listid}' "; $db->query($query); } else { $query = "insert into tb_ysyfmoney(\n\t fd_ysyfm_type , fd_ysyfm_companyid , fd_ysyfm_money \n\t )values(\n\t '{$unittype}' , '{$clientid}' , '{$endmoney}' \n\t )"; $db->query($query); } }
function basicnumber_update($listtype) { $db = new DB_test(); $query = "select * from tb_basicnumber where fd_bcnr_typeid = '{$listtype}'"; $db->query($query); if ($db->nf()) { $db->next_record(); $tmp_basicnumber = $db->f(fd_bcnr_design); $ltctcount = $db->f(fd_bcnr_count) + 1; $query = "update tb_basicnumber set\n\t fd_bcnr_count = fd_bcnr_count+1\n\t where fd_bcnr_typeid = '{$listtype}' "; $db->query($query); if ($ltctcount < 10) { $endltctcount = "000" . $ltctcount; } elseif ($ltctcount < 10000 and $ltctcount >= 1000) { $endltctcount = $ltctcount; } elseif ($ltctcount < 1000 and $ltctcount >= 100) { $endltctcount = "0" . $ltctcount; } elseif ($ltctcount < 100 and $ltctcount >= 10) { $endltctcount = "00" . $ltctcount; } else { $endltctcount = $ltctcount; } $listno = str_replace("{list_number}", $endltctcount, $tmp_basicnumber); } return $listno; }
function kickbackcashglide($accountid, $allmoney, $chgememo, $chgelisttype, $loginstaname, $listid, $listno, $cogetype, $kickbackid, $listdate) { $db = new DB_test(); $ishaverecord = 0; $query = "select * from tb_cashglide where fd_chge_accountid = '{$accountid}' \n\t and fd_chge_listid = '{$kickbackid}' and fd_chge_listtype = '{$chgelisttype}' "; $db->query($query); if ($db->nf()) { $ishaverecord = 1; } if ($allmoney != 0 && $ishaverecord == 0) { //----------帐户流水帐---------------- $query = "SELECT MAX(fd_chge_id) as chge_id FROM tb_cashglide where \n fd_chge_accountid = '{$accountid}' "; $db->query($query); if ($db->nf()) { $db->next_record(); $maxchgeid = $db->f(chge_id); $query = "select fd_chge_balance from tb_cashglide \n where fd_chge_id = '{$maxchgeid}' "; $db->query($query); if ($db->nf()) { $db->next_record(); $chgebalance = $db->f(fd_chge_balance); } else { $chgebalance = 0; } } else { $chgebalance = 0; } if ($allmoney != 0) { //金额不等于0 的才插进去。 if ($cogetype == 0) { $endchgebalance = $chgebalance + $allmoney; $query = "insert into tb_cashglide(\n fd_chge_date , fd_chge_accountid , fd_chge_listid , \n fd_chge_listno , fd_chge_listtype , fd_chge_addmoney ,\n fd_chge_lessen , fd_chge_balance , fd_chge_memo ,\n fd_chge_makename, fd_chge_datetime , fd_chge_iskickback ,\n fd_chge_listdate\n )values(\n now() , '{$accountid}' , '{$kickbackid}' ,\n '{$listno}' , '{$chgelisttype}' , '{$allmoney}' ,\n '0' , '{$endchgebalance}' , '{$chgememo}' ,\n '{$loginstaname}', now() , '2' ,\n '{$listdate}'\n )"; $db->query($query); } else { $endchgebalance = $chgebalance - $allmoney; $query = "insert into tb_cashglide(\n fd_chge_date , fd_chge_accountid , fd_chge_listid , \n fd_chge_listno , fd_chge_listtype , fd_chge_addmoney ,\n fd_chge_lessen , fd_chge_balance , fd_chge_memo ,\n fd_chge_makename, fd_chge_datetime , fd_chge_iskickback ,\n fd_chge_listdate\n )values(\n now() , '{$accountid}' , '{$kickbackid}' ,\n '{$listno}' , '{$chgelisttype}' , '0' ,\n '{$allmoney}' , '{$endchgebalance}' , '{$chgememo}' ,\n '{$loginstaname}', now() , '2' ,\n '{$listdate}'\n )"; $db->query($query); } $query = "update tb_cashglide set fd_chge_iskickback = 1 \n where fd_chge_listtype = '{$chgelisttype}' and fd_chge_listid = '{$listid}' \n and fd_chge_accountid = '{$accountid}'"; $db->query($query); //修改该单据的反冲状态 } } //------------------------------------ }
function getimageid($picurl) { $db = new DB_test(); $query = "select fd_cat_id from tb_category_list where fd_cat_url ='{$picurl}'"; $db->query($query); if ($db->nf()) { $db->next_record(); $id = $db->f(fd_cat_id); } return $id; }
function kickbackcommglide($storageid, $commid, $quantity, $cogememo, $cogelisttype, $loginstaname, $listid, $listno, $cogetype, $kickbackid, $listdate) { $db = new DB_test(); $ishaverecord = 0; $query = "select * from tb_commglide where fd_coge_sotrageid = '{$storageid}' and fd_coge_commid = '{$commid}'\n\t and fd_coge_listid = '{$kickbackid}' and fd_coge_listtype = '{$cogelisttype}' \n\t and (fd_coge_addquantity = '{$quantity}' or fd_coge_lessen = '{$quantity}')"; $db->query($query); if ($db->nf()) { $ishaverecord = 1; } if ($ishaverecord == 0) { $query = "SELECT MAX(fd_coge_id) as coge_id FROM tb_commglide where \n fd_coge_sotrageid = '{$storageid}' and fd_coge_commid = '{$commid}' "; $db->query($query); if ($db->nf()) { $db->next_record(); $maxcogeid = $db->f(coge_id); $query = "select fd_coge_balance from tb_commglide \n where fd_coge_id = '{$maxcogeid}' "; $db->query($query); if ($db->nf()) { $db->next_record(); $cogebalance = $db->f(fd_coge_balance); } else { $cogebalance = 0; } } else { $cogebalance = 0; } if ($cogetype == 0) { $endcogebalance = $cogebalance + $quantity; $query = "insert into tb_commglide(\n fd_coge_date , fd_coge_sotrageid , fd_coge_commid , \n fd_coge_listno , fd_coge_listtype , fd_coge_addquantity ,\n fd_coge_lessen , fd_coge_balance , fd_coge_memo ,\n fd_coge_listid , fd_coge_makename , fd_coge_datetime ,\n fd_coge_iskickback , fd_coge_listdate\n )values( \n now() , '{$storageid}' , '{$commid}' ,\n '{$listno}' , '{$cogelisttype}' , '{$quantity}' ,\n '0' , '{$endcogebalance}' , '{$cogememo}' ,\n '{$kickbackid}' , '{$loginstaname}' , now() ,\n '2' , '{$listdate}'\n )"; $db->query($query); } else { $endcogebalance = $cogebalance - $quantity; $query = "insert into tb_commglide(\n fd_coge_date , fd_coge_sotrageid , fd_coge_commid , \n fd_coge_listno , fd_coge_listtype , fd_coge_addquantity ,\n fd_coge_lessen , fd_coge_balance , fd_coge_memo ,\n fd_coge_listid , fd_coge_makename , fd_coge_datetime ,\n fd_coge_iskickback , fd_coge_listdate\n )values(\n now() , '{$storageid}' , '{$commid}' ,\n '{$listno}' , '{$cogelisttype}' , '0' ,\n '{$quantity}' , '{$endcogebalance}' , '{$cogememo}' ,\n '{$kickbackid}' , '{$loginstaname}' , now() ,\n '2' , '{$listdate}'\n )"; $db->query($query); } $query = "update tb_commglide set fd_coge_iskickback = 1 \n where fd_coge_listtype = '{$cogelisttype}' and fd_coge_listid = '{$listid}' \n and fd_coge_commid = '{$commid}' and fd_coge_sotrageid = '{$storageid}'"; $db->query($query); //修改该单据的反冲状态 } //------------------------------------ }
/** +---------------------------------------------------------- * 获取商品单价 * +---------------------------------------------------------- * @access public +---------------------------------------------------------- * @param string $agencyid 机构id * @param string $sdcrid 商家id * @param string $produreid 商品id * @param string $producetype 商品类型id * @param string $storageid 商品仓库id * @param string $pricetype 价格类型 (0=本位价格,20=令价,21=吨价) +---------------------------------------------------------- * @return string +---------------------------------------------------------- */ function getsdcrprice($agencyid, $sdcrid, $produreid, $producetype, $storageid, $pricetype = 0) { global $g_lprice_point; global $g_dprice_point; $db = new DB_test(); $query = "select fd_nbsepe_sdcrid,fd_nbsepe_produreid,fd_produre_catalog,fd_nbsepe_lingprice,fd_nbsepe_dunprice,fd_produre_unit\n\t\t\t from tb_websaleprice left join tb_produre on fd_produre_id = fd_nbsepe_produreid\n\t\t\t where fd_nbsepe_iskc = '1' and fd_nbsepe_sdcrid = '" . $sdcrid . "'\n\t\t\t and fd_nbsepe_produreid = '" . $produreid . "' and fd_nbsepe_producetype = '" . $producetype . "' \n\t\t\t and fd_nbsepe_isshow='1'"; // echo $query; $db->query($query); if ($db->nf()) { while ($db->next_record()) { $areaid = $db->f(fd_nbsepe_sdcrid); $produreid = $db->f(fd_nbsepe_produreid); $boxprocaid = $db->f(fd_produre_catalog); $unitid = $db->f(fd_produre_unit); if ($unitid == 20) { $returnvalue = round($db->f(fd_nbsepe_lingprice) * 1.04, 3); } if ($unitid == 21) { $returnvalue = round($db->f(fd_nbsepe_dunprice) * 1.04, 0); } if ($pricetype == 20) { $returnvalue = round($db->f(fd_nbsepe_lingprice) * 1.04, 3); } if ($pricetype == 21) { $returnvalue = round($db->f(fd_nbsepe_dunprice) * 1.04, 0); } } } $dbshop = new DB_shop(); $query = "select fd_skqy_lingprice ,fd_skqy_dunprice,fd_skqy_unitid,\n\t\t\tfd_skqy_shopid,fd_skqy_commid ,fd_skqy_rate \n\t\t\tfrom tb_shopkcquantity where fd_skqy_shopid = '{$sdcrid}' and fd_skqy_commid= '{$produreid}'\n\t\t\tand fd_skqy_producetype = '{$producetype}' and fd_skqy_storageid= '{$storageid}'\n\t\t\t"; $dbshop->query($query); if ($dbshop->nf()) { while ($dbshop->next_record()) { $unitid = $dbshop->f(fd_skqy_unitid); $vlingprice = $dbshop->f(fd_skqy_lingprice); $vdunprice = $dbshop->f(fd_skqy_dunprice); $rate = $dbshop->f(fd_skqy_rate); if ($unitid == 20) { $returnvalue = formatprice($vlingprice * $rate, $g_lprice_point); } if ($unitid == 21) { $returnvalue = formatprice($vdunprice * $rate, $g_dprice_point); } if ($pricetype == 20) { $returnvalue = formatprice($vlingprice * $rate, $g_lprice_point); } if ($pricetype == 21) { $returnvalue = formatprice($vdunprice * $rate, $g_dprice_point); } } } return $returnvalue + 0; }
function getggimg($scatid, $dateid) { $db = new DB_test(); $arr_img = explode("@@", $this->AutogetFileimg($scatid, $dateid)); //��ѯ��� $query = "select fd_ggwgl_link from tb_upload_ggwgl where fd_ggwgl_id = '{$dateid}'"; $db->query($query); if ($db->nf()) { $db->next_record(); $ggurl = $db->f(fd_ggwgl_link); } return $arr_img[0] . "@@" . $ggurl; }
function changenbmoney($qkorganid, $money, $type, $organid, $sdcrid) { //$type =0表示应收 , 1表示应付 $tmpflag = 0; $db = new DB_test(); if ($type == 0) { $endmoney = $money; } else { $endmoney = -$money; } $query = "select * from tb_nbysyfmoney where fd_nbysyfm_qkorganid = '{$qkorganid}'\n\t and fd_nbysyfm_organid = '{$organid}' and fd_nbysyfm_sdcrid = '{$sdcrid}' "; $db->query($query); if ($db->nf()) { $db->next_record(); $oldmoney = $db->f(fd_nbysyfm_money); $listid = $db->f(fd_nbysyfm_id); $newmoney = $oldmoney + $endmoney; $query = "update tb_nbysyfmoney set fd_nbysyfm_money = '{$newmoney}'\n\t\t where fd_nbysyfm_id = '{$listid}' "; $db->query($query); $tmpflag = 1; } $query = "select * from tb_nbysyfmoney where fd_nbysyfm_organid = '{$qkorganid}'\n\t and fd_nbysyfm_qkorganid = '{$organid}' and fd_nbysyfm_sdcrid = '{$sdcrid}'"; $db->query($query); if ($db->nf()) { $db->next_record(); $oldmoney = $db->f(fd_nbysyfm_money); $listid = $db->f(fd_nbysyfm_id); $newmoney = $oldmoney - $endmoney; $query = "update tb_nbysyfmoney set fd_nbysyfm_money = '{$newmoney}'\n\t\t where fd_nbysyfm_id = '{$listid}' "; $db->query($query); $tmpflag = 1; } if ($tmpflag == 0) { $query = "insert into tb_nbysyfmoney(\n\t fd_nbysyfm_qkorganid , fd_nbysyfm_money ,\n\t fd_nbysyfm_organid , fd_nbysyfm_sdcrid\n\t )values(\n\t '{$qkorganid}' , '{$endmoney}' ,\n\t '{$organid}' , '{$sdcrid}'\n\t )"; $db->query($query); //应收款 } }
function getappname($appmnuid) { $db = new DB_test(); if (!$appmnuid) { $appmnuid = 0; } $query = "select fd_appmnu_name from tb_appmenu where fd_appmnu_id in({$appmnuid})"; $db->query($query); if ($db->nf()) { while ($db->next_record()) { $appname .= $db->f('fd_appmnu_name') . " "; } } return $appname; }
function getauqrzname($auqid) { $db = new DB_test(); if (!$auqid) { $auqid = 0; } $query = "select fd_auq_name from tb_authorquali where fd_auq_id in({$auqid})"; $db->query($query); if ($db->nf()) { while ($db->next_record()) { $auqname .= $db->f('fd_auq_name') . " "; } } return $auqname; }
public function readMyAccount() { $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; $authorid = $arr_channelinfo['authorid']; $query = "select sum(fd_acc_money) as allaccmoney from tb_authoraccount where fd_acc_authorid = '{$authorid}' group by fd_acc_authorid "; $db->query($query); if ($db->nf()) { $db->next_record(); $allaccmoney = $db->f(allaccmoney); } $query = "select sum(fd_couponsale_money) as allaccmoney from tb_couponsale where fd_couponsale_authorid = '{$authorid}'" . " and fd_couponsale_payrq = '00' group by fd_couponsale_authorid "; $db->query($query); if ($db->nf()) { $db->next_record(); $allaccmoney += $db->f(allaccmoney); } $paytype = '非贷款'; $paytype = u2g($paytype); $paytype1 = '抵用券'; $paytype1 = u2g($paytype1); $query = "select 'recharge' as acctypeid ,'" . $paytype . "' as acctypename ,fd_acc_money as accmoney from tb_authoraccount " . "where fd_acc_authorid = '{$authorid}' " . " union all " . " select 'coupon' as acctypeid ,'" . $paytype1 . "' as acctypename ,sum(fd_couponsale_money) as couponmoney from \n\t\t\t tb_couponsale where fd_couponsale_authorid = '{$authorid}' and fd_couponsale_payrq = '00' and fd_couponsale_isagentpay = '0' group by fd_couponsale_authorid "; $db->query($query); $arr_msg = auto_charset($db->getData('', 'msgbody'), 'gbk', 'utf-8'); $arr_msg['msgbody']['accallmoney'] = $allaccmoney; $arr_message = array("result" => "success", "message" => "读取成功!"); $retcode = "0"; //反馈状态 0 成功 200 自定义错误 $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
function move($fd_cat_id) { $db = new DB_test(); $query = "select fd_cat_dateid,fd_cat_name,fd_cat_scatid,fd_cat_url,fd_cat_thumurl ,fd_cat_cancel from tb_upload_category_list where fd_cat_id='{$fd_cat_id}'"; $db->query($query); $db->next_record(); $fd_cat_dateid = $db->f(fd_cat_dateid); $fd_cat_scatid = $db->f(fd_cat_scatid); $fd_cat_name = $db->f(fd_cat_name); $fd_cat_url = $db->f(fd_cat_url); $fd_cat_thumurl = $db->f(fd_cat_thumurl); $fd_cat_cancel = $db->f(fd_cat_cancel); $query = "INSERT INTO tb_upload_old_image (\n\t\t\t\t\t\tfd_cat_dateid ,fd_cat_scatid , fd_cat_url,\n\t\t\t\t\t\tfd_cat_cancel ,fd_cat_time, fd_cat_thumurl,\n\t\t\t\t\t\tfd_cat_name\n\t\t\t\t\t )VALUES (\n\t\t\t\t\t '{$fd_cat_dateid}' ,'{$fd_cat_scatid}' , '{$fd_cat_url}',\n\t\t\t\t\t '{$fd_cat_cancel}' ,now() , '{$fd_cat_thumurl}',\n\t\t\t\t\t '{$fd_cat_name}'\n\t\t\t\t\t )"; $db->query($query); }
function readsalebackdunshu($year, $month, $memid) { $db = new DB_test(); $dberp = new DB_erp2(); $query = "select * from tb_organmem where fd_organmem_id = '{$memid}'"; $db->query($query); $db->next_record(); $cusid = $db->f(fd_organmem_cusid); $month = $month + 0; $year = $year + 0; $query = "select \n sum(fd_sebk_alldunshu) as allquantity,\n fd_sebk_cusid\n from tb_saleback \n left join tb_salelist on fd_sebk_salelistid = fd_selt_id\n where year(fd_selt_date) = '{$year}' and month(fd_sebk_date) = '{$month}' and fd_sebk_state = 1\n and fd_sebk_iskickback = 0 and fd_sebk_organid = 1 and fd_sebk_cusid = '{$cusid}'\n group by fd_sebk_cusid\n "; $dberp->query($query); $dberp->next_record(); $dunshu = $dberp->f(allquantity); return $dunshu; }
function addelete($dateid, $scatid) { $db = new DB_test(); clearFilepath($dateid); //ɾ³ýͼƬ $query = "select *from tb_upload_category_list where fd_cat_dateid='{$dateid}' and fd_cat_scatid='{$scatid}'"; $db->query($query); $db->next_record(); $url = $db->f(fd_cat_url); $thumurl = $db->f(fd_cat_thumurl); @unlink($url); @unlink($thumurl); //ɾ³ýÊý¾Ý $del = "delete from tb_upload_category_list where fd_cat_dateid='{$dateid}' and fd_cat_scatid='{$scatid}'"; $db->query($del); }
function makeorderno($tablename, $fieldname, $preno = "pay") { $db = new DB_test(); $db2 = new DB_test(); $year = trim(date("Y", mktime())); $month = trim(date("m", mktime())); $day = trim(date("d", mktime())); $strlenght = strlen($preno); $nowdate = $year . $month . $day; $query = "select fd_" . $fieldname . "_no as no from " . $tablename . " order by fd_" . $fieldname . "_no desc"; $db2->query($query); if ($db2->nf()) { $db2->next_record(); $orderno = $db2->f(no); $orderdate = substr($orderno, $strlenght, 8); //截取前8位判断是否当前日期 if ($nowdate == $orderdate) { $newlenght = $strlenght + 11; $orderno = substr($orderno, $newlenght, 14) + 1; //是当前日期流水帐加1 if ($orderno < 10) { $orderno = "00000" . $orderno; } else { if ($orderno < 100) { $orderno = "0000" . $orderno; } else { if ($orderno < 1000) { $orderno = "000" . $orderno; } else { if ($orderno < 10000) { $orderno = "00" . $orderno; } else { $orderno = $orderno; } } } } $orderno = $preno . $nowdate . $orderno; } else { $orderno = $preno . $nowdate . "000001"; //不是当前日期,为5位流水帐,开始值为1。 } } else { $orderno = $preno . $nowdate . "000001"; } return $orderno; }
function readproduct($commid) { $db = new DB_test(); $query = "select fd_kgweight_name,fd_produre_long,fd_produre_width,fd_produre_relation1,fd_produre_relation2,fd_produre_relation3 ,\n\t fd_guige_name\n\t from tb_produre \n\t left join tb_kgweight on fd_kgweight_id = fd_produre_kgweight \n\t left join tb_guige on fd_guige_id = fd_produre_spec \n\t where fd_produre_id = '{$commid}'"; $db->query($query); if ($db->nf()) { $db->next_record(); $kgweight = $db->f(fd_kgweight_name); $long = $db->f(fd_produre_long); $width = $db->f(fd_produre_width); $relation1 = $db->f(fd_produre_relation1); $relation2 = $db->f(fd_produre_relation2); $relation3 = $db->f(fd_produre_relation3); $spec = $db->f(fd_guige_name); } return $kgweight . "@@@" . $long . "@@@" . $width . "@@@" . $relation1 . "@@@" . $relation2 . "@@@" . $relation3 . "@@@" . $spec; }
function autologin($username, $password) { $db = new DB_test(); $db1 = new DB_test(); $query = "select * from web_teller where fd_tel_name ='{$username}' "; $db->query($query); if ($db->nf()) { $db->next_record(); $pass = $db->f(fd_tel_pass); //密码 $error = $db->f(fd_tel_error); //错误次数 $recsts = $db->f(fd_tel_recsts); //是否已经被禁此 $isin = $db->f(fd_tel_isin); //是否已经登陆 $telid = $db->f(fd_tel_id); //id号 if ($pass != $password) { $errmsg = "密码错误!(请注意区分大小写)"; $query = "update web_teller set fd_tel_error = fd_tel_error +1 where fd_tel_name ='{$username}'"; $db1->query($query); $return = 2; } if ($error >= 6) { $errmsg = "由于密码错误多次,禁止使用该用户!"; $return = 3; } if ($recsts == 1) { $errmsg = "该用户被停用!"; $return = 4; } if ($pass == $password and $return < 2) { // 密码正确 $query = "update web_teller set \t\t\t \n\t \t\t fd_tel_lasttime = fd_tel_intime, fd_tel_intime = now(),fd_tel_outtime = now(),\n\t \t\t fd_tel_error = 0,fd_tel_isin = 1 , fd_tel_onlinetime = now()\n\t where fd_tel_id ='{$telid}'"; $db->query($query); $return = 1; } } else { $errmsg = "该用户不存在!"; $return = 9; } return $return; }
function getshowpaycradid($tabname, $filename, $id) { $db = new DB_test(); $query = 'select fd_' . $filename . '_paycardid as paycardid from ' . $tabname . ' where fd_' . $filename . '_id="' . $id . '" '; $db->query($query); if ($db->nf()) { $db->next_record(); $paycardid = $db->f(paycardid); $arr_paycardid1 = explode(",", $paycardid); foreach ($arr_paycardid1 as $va) { if ($strpaycardid) { $strpaycardid .= "," . "'{$va}'"; } else { $strpaycardid = "'{$va}'"; } } } return $strpaycardid; }
public function readcouponinfo() { $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; $authorid = $arr_channelinfo['authorid']; $query = "select fd_coupon_id as couponid ,fd_coupon_money as couponmoney,fd_coupon_limitnum as couponlimitnum from tb_coupon where fd_coupon_active = '1'\n\t\t\t order by fd_coupon_no"; $db->query($query); $arr_msg = auto_charset($db->getData('', 'msgbody'), 'gbk', 'utf-8'); $query = "select fd_author_shopid from tb_author where fd_author_id = '{$authorid}'"; $db->query($query); if ($db->nf()) { $db->next_record(); $shopid = $db->f('fd_author_shopid'); } $arr_shopinfo = getauthorshop($shopid); $shopname = $arr_shopinfo['shopname']; if ($shopname) { $isshop = 1; $arr_message = array("result" => "success", "message" => "读取抵用券信息成功!"); $retcode = "0"; //反馈状态 0 成功 200 自定义错误 } else { $ishop = 0; $arr_message = array("result" => "failure", "message" => "还未开通商家,不允许购买抵用券!"); $retcode = "200"; //反馈状态 0 成功 200 自定义错误 } $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $arr_msg['msgbody']['shopname'] = $shopname; $arr_msg['msgbody']['isshop'] = $isshop; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
function readmember($memid) { $db = new DB_test(); $query = "select fd_organmem_phone,fd_organmem_mobile,fd_organmem_address,fd_organmem_comnpany,fd_organmem_linkman,fd_organmem_email,\n\t fd_organmem_province,fd_organmem_city,fd_organmem_county,fd_organmem_username,fd_organmem_cusname,fd_organmem_cusid,\n\t fd_organmem_cusno,fd_organmem_isms\n\t from tb_organmem \n\t where fd_organmem_id = '{$memid}'"; $db->query($query); if ($db->nf()) { $db->next_record(); $phone = $db->f(fd_organmem_phone); $mobile = $db->f(fd_organmem_mobile); $address = $db->f(fd_organmem_address); $comnpany = $db->f(fd_organmem_comnpany); $linkman = $db->f(fd_organmem_linkman); $email = $db->f(fd_organmem_email); $province = $db->f(fd_organmem_province); $city = $db->f(fd_organmem_city); $county = $db->f(fd_organmem_county); $username = $db->f(fd_organmem_username); $cusname = $db->f(fd_organmem_cusname); $cusid = $db->f(fd_organmem_cusid); $cusno = $db->f(fd_organmem_cusno); $isms = $db->f(fd_organmem_isms); } return $phone . "@@@" . $mobile . "@@@" . $address . "@@@" . $comnpany . "@@@" . $linkman . "@@@" . $email . "@@@" . $province . "@@@" . $city . "@@@" . $county . "@@@" . $username . "@@@" . $cusid . "@@@" . $cusno . "@@@" . $cusname . "@@@" . $isms; }
$db = new DB_test(); //$dbtj = new DB_test ; $t = new Template('.', "keep"); $t->set_file("tb_payment_yearview", "tb_payment_yearview.html"); $t->set_block("tb_payment_yearview", "BXBK", "bxbks"); if ($bgcolor == "#FFFFFF") { $bgcolor = "#F1F4F9"; } else { $bgcolor = "#FFFFFF"; } require "../report/getpaycardmenu.php"; //获取交易类型菜单 $query = "select\n\t\tfd_agpm_paytype as paytype,\n\t\tdate_format(fd_agpm_paydate,'%Y') as paydate ,\n\t\tsum(fd_agpm_paymoney) as paymoney,\n\t\tsum(fd_agpm_sdcrpayfeemoney+fd_agpm_sdcragentfeemoney) as cbmoney,\n sum(fd_agpm_payfee) as payfee,\n\t\tsum(fd_agpm_agentmoney) as agentmoney\t\t \n\t\tfrom tb_agentpaymoneylist \n\t\tleft join tb_appmenu on fd_appmnu_no = fd_agpm_paytype\t\n\t\twhere fd_agpm_payrq='00' and fd_appmnu_istabno = 1\n\t\t\tgroup by paydate,fd_agpm_paytype\n\t\t\torder by fd_agpm_paydate desc"; $db->query($query); if ($db->nf()) { while ($db->next_record()) { $paytype = $db->f(paytype); $paydate = $db->f(paydate); $arr_paydate[] = $paydate; $arr_result[$paydate][$paytype]['paymoney'] = $db->f(paymoney); $arr_result[$paydate][$paytype]['cbmoney'] = $db->f(cbmoney); $arr_result[$paydate][$paytype]['payfee'] = $db->f(payfee); $arr_result[$paydate][$paytype]['agentmoney'] = $db->f(agentmoney); $arr_result[$paydate]['allyearpaymoney'] += $db->f(paymoney); $arr_result[$paydate]['allyearagentmoney'] += $db->f(agentmoney); $arr_result[$paydate]['allyearcbmoney'] += $db->f(cbmoney); $arr_result[$paydate]['allyearpayfee'] += $db->f(payfee); } } $arr_paydate = array_unique($arr_paydate); //循环时间流出数据
<?php $thismenucode = ""; require "../include/common.inc.php"; require "../include/log.php"; $db = new DB_test(); $db2 = new DB_test(); $t = new Template(".", "keep"); //调用一个模版 $gourl = "tb_salebackview_b.php"; $gotourl = $gourl . $tempurl; $query = "SELECT * FROM tb_salelistback WHERE fd_selt_id = '{$listid}'"; $db->query($query); $db->next_record(); //读取记录数据 $id = $db->f(fd_sebk_id); //id号 $no = $db->f(fd_sebk_no); //单据编号 $cusid = $db->f(fd_sebk_cusid); //客户id $cusno = $db->f(fd_sebk_cusno); //客户编号 $cusname = $db->f(fd_sebk_cusname); //客户名称 $now = $db->f(fd_sebk_date); //录单日期 $dept = $db->f(fd_dept_name); //部门 $staid = $db->f(fd_sebk_staid); //录单人ID
if ($db->nf()) { while ($db->next_record()) { $authorid[] = $db->f(fd_author_id); } } if ($authorid != '') { $arr_authorid = $authorid; for ($i = 0; $i < count($arr_authorid); $i++) { $dateid = $arr_authorid[$i]; //echo $dateid."</br>"; $getFileimg = new AutogetFile(); //$propiclist = explode("@@",$getFileimg->AutogetFileimg(1,$dateid)); $query1 = "select * from tb_author where fd_author_id='{$dateid}'"; $db1->query($query1); if ($db1->nf()) { $db1->next_record(); $protraname = $db1->f(fd_author_username); $tradindexrec = $db1->f(fd_procatrad_indexrec); } $preprocaid .= "<input type='checkbox' checked='true' title='{$protraname}' name='arr_count[]' value='{$arr_authorid[$i]}' onclick='copyItem(\"previewItem\",\"previewItem\");same(this);'>" . $protraname; $thumrul = $propiclist[0]; if ($thumrul != "") { $showtitle = $tradindexrec ? "<span style='color:#0000ff'>取消首页推荐</span>" : "<span style='color:red'>设为首页推荐</span>"; $vpic = "<img src='" . $propiclist[0] . "' title='" . $protraname . "' alt='" . $protraname . "'\n\t\t\t\t width='100' style='height:40px;'>"; $vedit = '<a href="#" onClick="del_p(' . $propiclist[1] . ')">删除</a>|<a href="#" onclick="set_indexrec(' . $dateid . ',' . $tradindexrec . ')">' . $showtitle . '</a>'; } else { $vpic = "<img src='' width='100' title='" . $protraname . "' alt='" . $protraname . "' style='height:40px;'>"; $vedit = '<input type=hidden name=uploadfile id="uploadfile' . $dateid . '" value=""> <input type="button" class="buttonsmall" name="upmorefiles" value="上传图片" onclick=uploadimg("36","' . $dateid . '","' . $propiclist[1] . '","uploadfile","new","refeedback","preuploadfile",this); >'; }
for ($i = 0; $i < count($prg_shortcut); $i++) { if (empty($str_prgqx)) { //把权限功能组合为字符 $str_prgqx = $prg_shortcut[$i]; } else { $str_prgqx .= "±" . $prg_shortcut[$i]; } } $query = "update web_teller set fd_tel_shortcut = '{$str_prgqx}' where fd_tel_id = '{$loginuser}'"; $db->query($query); } //------------查询权限和快捷菜单--------------------- $query = "select * from web_teller \n\t left join web_usegroup on fd_usegroup_id = fd_tel_usegroupid\n\t where fd_tel_id = '{$loginuser}' "; $db->query($query); if ($db->nf()) { $db->next_record(); $telqx = $db->f(fd_tel_doprg); //用户权限 $groupqx = $db->f(fd_usegroup_qx); //用户组权限 $telname = $db->f(fd_tel_name); //用户名字 $shortcut = $db->f(fd_tel_shortcut); //用于已经选择的快捷件 //用户组权限分切 $arr_prgqx = explode("±", $groupqx); for ($i = 0; $i < count($arr_prgqx); $i++) { $temp_arr = explode("@", $arr_prgqx[$i]); $tmpcode = $temp_arr[0]; //功能代号 $prgqx_arr[$tmpcode] = 1;
function getauthoruse($authorid, $scope, $scdmsetid) { $db = new DB_test(); $newdate = date("Y-m", time()); $query = "select count(*) as paycount,sum(fd_agpm_paymoney) as paymoney,fd_agpm_paydate as paydate, date_format(fd_agpm_paydate,'%Y-%m') as newdate ,fd_paycard_scope as scope from tb_agentpaymoneylist left join tb_paycard on fd_agpm_paycardid=fd_paycard_id where fd_agpm_authorid='{$authorid}' and date_format(fd_agpm_paydate,'%Y-%m')='{$newdate}' and fd_agpm_payrq='00' group by fd_agpm_paydate,scope"; $db->query($query); if ($db->nf()) { while ($db->next_record()) { $paydate = $db->f(paydate); $newdate = $db->f(newdate); $scope = $db->f(scope); $date_authorues[$paydate][$scope]['fd_scdmset_nallmoney'] = $db->f(paymoney) + 0; //今月已用额度 $date_authorues[$paydate][$scope][''] = ''; $date_authorues[$paydate][$scope]['fd_scdmset_everycounts'] = $db->f(paycount) + 0; //每日已刷卡次数 $date_authorues[$newdate][$scope]['fd_scdmset_sallmoney'] += $db->f(paymoney); //今月审批额度 } } $query = "SELECT date_format(fd_pmreq_reqdatetime,'%Y-%m-%d') AS reqdatetime ,date_format(fd_pmreq_reqdatetime,'%Y-%m') AS datetime ,SUM(fd_pmreq_reqmoney) AS repmoney ,fd_scdmset_scope AS scope FROM tb_slotcardmoneyreq LEFT JOIN tb_slotcardmoneyset ON fd_scdmset_id = fd_pmreq_paymsetid WHERE fd_pmreq_authorid='{$authorid}' AND fd_pmreq_paymsetid='{$scdmsetid}' AND date_format(fd_pmreq_reqdatetime,'%Y-%m') = '{$newdate}' AND fd_pmreq_state <>'0' GROUP BY reqdatetime,scope "; $db->query($query); if ($db->nf()) { while ($db->next_record()) { $reqdatetime = $db->f(reqdatetime); $scope = $db->f(scope); $datetime = $db->f(datetime); $date_authorues[$reqdatetime][$scope]['fd_scdmset_neverymoney'] = $db->f(repmoney) + 0; //今日已用额度 $date_authorues[$datetime][$scope]['fd_scdmset_severymoney'] += $db->f(repmoney); //今日已审批额度 } } return $date_authorues; }
public function readAuBkCardInfo() { $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; $authorid = trim($arr_channelinfo['authorid']); $arr_message = array("error_id" => "0", "result" => "success", "message" => "读取成功"); $retcode = "0"; //反馈状态 0 成功 200 自定义错误 $query = "select * from tb_author where fd_author_id = '{$authorid}'"; $db->query($query); if ($db->nf()) { $db->next_record(); $arr_msg['msgbody']['aushoucardman'] = g2u($db->f(fd_author_shoucardman)); $arr_msg['msgbody']['aushoucardphone'] = $db->f(fd_author_shoucardphone); $arr_msg['msgbody']['aushoucardno'] = $db->f(fd_author_shoucardno); $arr_msg['msgbody']['aushoucardbank'] = g2u($db->f(fd_author_shoucardbank)); $arr_msg['msgbody']['aushoucardstate'] = $db->f(fd_author_shoucardstate) + 0; } else { $arr_message = array("error_id" => "1", "result" => "failure", "message" => "用户信息已失效,请重新登录"); $retcode = "200"; //反馈状态 0 成功 200 自定义错误 } $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }