123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- class invoice_service {
- private $invoiceTraining;
- private $invoice;
- private $XDeode;
- function __construct() {
- Doo::loadClass ( 'XDeode' );
- $this->XDeode = new XDeode ( 9 );
- $this->XDeode5 = new XDeode ( 5 );
- Doo::loadModel ( 'cld/invoice_training_cld' );
- $this->invoiceTraining = new invoice_training_cld ();
- Doo::loadModel ( 'cld/invoice_cld' );
- $this->invoice = new invoice_cld ();
- }
-
- /* 获得办事处和创建的 培训班发票 */
- public function getTrainByCategoryStaff($status, $categoryIdString, $staffId) {
-
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'L_category' );
- $lCategory = new L_category ();
-
- // 1.获得培训班
- $list = $this->invoiceTraining->getStatusByCategoryStaff ( $status, $categoryIdString, $staffId );
-
- // 2.获得培训班发票总数-
- foreach ( $list as $key => $value ) {
- $list [$key] ['trainingKey'] = $this->XDeode5->encode ( $value ['itid'] );
- $detail = $staff->getStaffBySid ( $value ['creator'] );
- $list [$key] ['staff'] = $detail;
- $detail = $lCategory->getCategoryById ( $value ['cid'] );
- $list [$key] ['category'] = $detail;
-
- // 每个培训班发票总数和金额,入账总数
- $invoiceList = $this->invoice->GetTrainByUnFinish ( $value ['itid'] );
-
- $list[$key]['invoiceTotal']=count($invoiceList);
- $priceTotle=0;
- $BalancePriceTotle=0;
- foreach ($invoiceList as $k=>$v){
- $priceTotle+=$v['invoicePrice'];
- if($v['status']==2&&$v['untreadStatus']==3){
- $BalancePriceTotle+=$v['invoiceBalance'];
- }else{
- $BalancePriceTotle+=$v['invoicePrice'];
- }
-
- }
- $list[$key]['invoiceTotalAmount']=$priceTotle;
- $list[$key]['invoiceArriveAmount']=$priceTotle-$BalancePriceTotle;
- $list[$key]['arriveSchedule']=0;
- if($list[$key]['invoiceTotal']!=0){
- $list[$key]['arriveSchedule']=round ( $list [$key] ['invoiceArriveAmount'] / $list [$key] ['invoiceTotalAmount'] * 100, 2 );
- }
-
- }
- return $list;
- // print_r ( $list );
- // die ();
- }
- }
- ?>
|