|
@@ -54,15 +54,14 @@ class invoiceTraining extends DooModel {
|
|
|
}
|
|
|
return $itid;
|
|
|
}
|
|
|
- function getInvoiceTrainStatistics($itid=0) {
|
|
|
-
|
|
|
- $itidCondition=' and trainId=NULL ';
|
|
|
- if (!empty($itid))
|
|
|
- $itidCondition=' and trainId in ('.$itid.') ';
|
|
|
+ function getInvoiceTrainStatistics($itid = 0) {
|
|
|
+ $itidCondition = ' and trainId=NULL ';
|
|
|
+ if (! empty ( $itid ))
|
|
|
+ $itidCondition = ' and trainId in (' . $itid . ') ';
|
|
|
|
|
|
$sql = 'select sum(invoicePrice) as invoicePrice ,trainId
|
|
|
from CLD_invoice
|
|
|
- where status=2 and printStatus=1 and (untreadStatus =0 or untreadStatus=3) '.$itidCondition.'
|
|
|
+ where status=2 and printStatus=1 and (untreadStatus =0 or untreadStatus=3) ' . $itidCondition . '
|
|
|
GROUP BY status';
|
|
|
$query = Doo::db ()->query ( $sql );
|
|
|
$result = $query->fetchAll ();
|
|
@@ -76,18 +75,16 @@ class invoiceTraining extends DooModel {
|
|
|
'invoicePrice' => 0
|
|
|
);
|
|
|
// print_r($result);
|
|
|
- $itidCondition=' and a.trainId=NULL ';
|
|
|
- if (!empty($itid))
|
|
|
- $itidCondition=' and a.trainId in ('.$itid.') ';
|
|
|
+ $itidCondition = ' and a.trainId=NULL ';
|
|
|
+ if (! empty ( $itid ))
|
|
|
+ $itidCondition = ' and a.trainId in (' . $itid . ') ';
|
|
|
$sql = 'select sum(b.receivablesPrice) as receivablesPrice ,a.trainId,count(*) as count
|
|
|
from CLD_invoice as a left join CLD_invoiceReceivables as b on find_in_set(b.irid,a.irid)
|
|
|
- where a.status=2 and a.printStatus=1 and (a.untreadStatus =0 or a.untreadStatus=3) and a.irid!="" '.$itidCondition.'
|
|
|
+ where a.status=2 and a.printStatus=1 and (a.untreadStatus =0 or a.untreadStatus=3) and a.irid!="" ' . $itidCondition . '
|
|
|
GROUP BY a.status';
|
|
|
$query = Doo::db ()->query ( $sql );
|
|
|
$result = $query->fetchAll ();
|
|
|
|
|
|
-
|
|
|
-
|
|
|
if (! empty ( $result )) {
|
|
|
$detail += array (
|
|
|
'receivablesPrice' => $result [0] ['receivablesPrice']
|
|
@@ -105,14 +102,14 @@ class invoiceTraining extends DooModel {
|
|
|
}
|
|
|
return $detail;
|
|
|
}
|
|
|
- function getInvoiceTrainingByTodo($select = "", $cid = 0,$sid=0) {
|
|
|
+ function getInvoiceTrainingByTodo($select = "", $cid = 0, $sid = 0) {
|
|
|
Doo::loadModel ( 'staff' );
|
|
|
$staff = new staff ();
|
|
|
Doo::loadModel ( 'L_category' );
|
|
|
$lCategory = new L_category ();
|
|
|
|
|
|
$condition = array (
|
|
|
- 'where' => "(status= 0 or status=1) and ( cid=" . $cid." or creator=".$sid." )",
|
|
|
+ 'where' => "(status= 0 or status=1) and ( cid=" . $cid . " or creator=" . $sid . " )",
|
|
|
'limit' => 8,
|
|
|
'asArray' => TRUE
|
|
|
);
|
|
@@ -139,7 +136,7 @@ class invoiceTraining extends DooModel {
|
|
|
Doo::loadModel ( 'invoice' );
|
|
|
$invoice = new invoice ();
|
|
|
|
|
|
- $invoiceList=$invoiceRecelvablesList=array();
|
|
|
+ $invoiceList = $invoiceRecelvablesList = array ();
|
|
|
if (! empty ( $itid )) {
|
|
|
$itidSql = implode ( ',', $itid );
|
|
|
$invoiceList = $invoice->sumOfinvoiceTrain ( $itidSql );
|
|
@@ -198,14 +195,14 @@ class invoiceTraining extends DooModel {
|
|
|
* 根据状态获取培训班
|
|
|
* @param number $status
|
|
|
*/
|
|
|
- function getInvoiceTrainingByStatus($status = 0, $select = "", $cid = 0,$sid=0) {
|
|
|
+ function getInvoiceTrainingByStatus($status = 0, $select = "", $cid = 0, $sid = 0) {
|
|
|
Doo::loadModel ( 'staff' );
|
|
|
$staff = new staff ();
|
|
|
Doo::loadModel ( 'L_category' );
|
|
|
$lCategory = new L_category ();
|
|
|
|
|
|
$condition = array (
|
|
|
- 'where' => "status= '" . $status . "' and (cid=" . $cid." or creator=".$sid." )",
|
|
|
+ 'where' => "status= '" . $status . "' and (cid=" . $cid . " or creator=" . $sid . " )",
|
|
|
'limit' => 8,
|
|
|
'asArray' => TRUE
|
|
|
);
|
|
@@ -261,14 +258,33 @@ class invoiceTraining extends DooModel {
|
|
|
$this->delete ( array (
|
|
|
'where' => 'itid=' . $itid
|
|
|
) );
|
|
|
- //删除培训班下的发票
|
|
|
+ // 删除培训班下的发票
|
|
|
Doo::loadModel ( 'invoiceStore' );
|
|
|
$invoiceStore = new invoiceStore ();
|
|
|
|
|
|
- $invoiceStore->delete(array (
|
|
|
- 'where' => 'trainId=' . $itid
|
|
|
- ));
|
|
|
+ $invoiceStore->delete ( array (
|
|
|
+ 'where' => 'trainId=' . $itid
|
|
|
+ ) );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获得所有培训班
|
|
|
+ */
|
|
|
+ function getInvoiceTrainingBySubmitStatus() {
|
|
|
+ $condition = array (
|
|
|
+ 'where' => "submitStatus=1",
|
|
|
+ 'asArray' => TRUE
|
|
|
+ );
|
|
|
+
|
|
|
+ $list = $this->find ( $condition );
|
|
|
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+ foreach ( $list as $key => $value ) {
|
|
|
+ $list[$key] ['itidKey'] = $XDeode->encode ( $value ['itid'] );
|
|
|
+ }
|
|
|
+
|
|
|
+ return $list;
|
|
|
}
|
|
|
}
|
|
|
|