|
@@ -453,6 +453,8 @@ class InvoiceController extends DooController {
|
|
|
$invoiceQuantity = $this->get_args ( 'invoiceQuantity' ) && is_numeric ( $this->get_args ( 'invoiceQuantity' ) ) ? $this->get_args ( 'invoiceQuantity' ) : 0;
|
|
|
$invoiceUnitPrice = $this->get_args ( 'invoiceUnitPrice' ) && is_numeric ( $this->get_args ( 'invoiceUnitPrice' ) ) ? $this->get_args ( 'invoiceUnitPrice' ) : 0;
|
|
|
|
|
|
+ $invoiceForm = $this->get_args ( 'invoiceForm' ) ? $this->get_args ( 'invoiceForm' ) : "";
|
|
|
+
|
|
|
$invoiceElement = $this->get_args ( 'invoiceElement' ) ? $this->get_args ( 'invoiceElement' ) : "";
|
|
|
$invoiceTitle = $this->get_args ( 'invoiceTitle' ) ? $this->get_args ( 'invoiceTitle' ) : "";
|
|
|
$invoiceCompany = $this->get_args ( 'invoiceCompany' ) ? $this->get_args ( 'invoiceCompany' ) : "";
|
|
@@ -524,7 +526,7 @@ class InvoiceController extends DooController {
|
|
|
if (empty ( $this->staff [0] ))
|
|
|
die ( 'illegal request-Please login' );
|
|
|
|
|
|
- if (! empty ( $cid ) && ! empty ( $invoiceQuantity ) && ! empty ( $invoiceUnitPrice ) && ! empty ( $invoiceElement ) && ! empty ( $settlementType )) {
|
|
|
+ if (! empty ( $cid ) && ! empty ( $invoiceQuantity ) && ! empty ( $invoiceUnitPrice ) && ! empty ( $invoiceElement ) && ! empty ( $settlementType )&&!empty($invoiceForm)) {
|
|
|
Doo::loadModel ( 'invoice' );
|
|
|
$invoice = new invoice ();
|
|
|
Doo::loadModel ( 'L_category' );
|
|
@@ -576,10 +578,22 @@ class InvoiceController extends DooController {
|
|
|
die ( 'illegal request-settlementError' );
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ if($invoiceForm=='electronic'){
|
|
|
+ $invoiceSerial="#FE" . date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);
|
|
|
+ $invoiceForm=1;
|
|
|
+ }elseif($invoiceForm=='paper'){
|
|
|
+ $invoiceSerial="#F" . date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);
|
|
|
+ $invoiceForm=0;
|
|
|
+ }else{
|
|
|
+ die ( 'illegal request-invoiceForm' );
|
|
|
+ }
|
|
|
+
|
|
|
$item = array (
|
|
|
'cid' => $cid,
|
|
|
'categoryName' => $categoryDetil ['title'],
|
|
|
'invoiceElement' => $invoiceElement,
|
|
|
+ 'invoiceForm'=>$invoiceForm,
|
|
|
|
|
|
'invoiceQuantity' => $invoiceQuantity,
|
|
|
'invoiceUnitPrice' => $invoiceUnitPrice,
|
|
@@ -589,7 +603,7 @@ class InvoiceController extends DooController {
|
|
|
'settlementType' => $st,
|
|
|
'doPost' => $doPost,
|
|
|
'status' => 1,
|
|
|
- 'invoiceSerial' => "#F" . date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT),
|
|
|
+ 'invoiceSerial' => $invoiceSerial,
|
|
|
'date' => date ( "Y-m-d H:i:s" ),
|
|
|
'updateTime' => date ( "Y-m-d H:i:s" ),
|
|
|
'sid' => $this->staff [0] ['sid'],
|
|
@@ -2568,7 +2582,7 @@ class InvoiceController extends DooController {
|
|
|
if (empty ( $invoiceDetail ))
|
|
|
die ( 'illegal request' );
|
|
|
|
|
|
- $invoicePaperList = $invoicePaper->getInvoicePaperByInvoiceType ( $invoiceDetail ['invoiceType'] );
|
|
|
+ $invoicePaperList = $invoicePaper->getInvoicePaperByInvoiceType ( $invoiceDetail ['invoiceType'],$invoiceDetail['invoiceForm'] );
|
|
|
$invoiceOperationLogList = $invoiceOperationLog->getInvoiceOperationLogByIid ( $iid );
|
|
|
|
|
|
if ($invoiceDetail ['settlementType'] == 1) {
|
|
@@ -2940,7 +2954,7 @@ class InvoiceController extends DooController {
|
|
|
$limit = '0,20';
|
|
|
$list = $invoice->getInvoiceByUntreadStatusPage ( $limit, $sql );
|
|
|
|
|
|
- // print_r($list);
|
|
|
+ //print_r($list);
|
|
|
$this->data ['MebSeaEn'] = $MebSea;
|
|
|
/*
|
|
|
* $this->data ['get'] = $get; $this->data ['page'] = $pageinfo; $this->data ['date'] = $date;
|
|
@@ -4142,6 +4156,25 @@ class InvoiceController extends DooController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 电子发票管理
|
|
|
+ */
|
|
|
+ function invoiceElectronic() {
|
|
|
+ $status = $this->get_args ( 'status' ) ? $this->get_args ( 'status' ) : 'ALL';
|
|
|
+ $invoiceType = $this->get_args ( 'invoiceType' ) ? $this->get_args ( 'invoiceType' ) : "ALL";
|
|
|
+
|
|
|
+ $date = $this->get_args ( 'date' ) ? $this->get_args ( 'date' ) : "";
|
|
|
+
|
|
|
+ $this->data ['dateString'] = $date;
|
|
|
+ $this->data ['status'] = $status;
|
|
|
+ $this->data ['invoiceType'] = $invoiceType;
|
|
|
+
|
|
|
+ $this->data ['memu'] = "invoice";
|
|
|
+ $this->data ['staff'] = $this->staff;
|
|
|
+ $this->data ['receiptMemu'] = 'invoicePaper';
|
|
|
+ $this->render ( "/invoice/invoiceElectronic", $this->data );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 获得纸票分页数据
|
|
|
*/
|
|
|
function ajaxGetinvoicePaperAchieve() {
|
|
@@ -4151,6 +4184,8 @@ class InvoiceController extends DooController {
|
|
|
$status = $this->get_args ( 'status' ) ? $this->get_args ( 'status' ) : 'ALL';
|
|
|
$invoiceType = $this->get_args ( 'invoiceType' ) ? $this->get_args ( 'invoiceType' ) : "ALL";
|
|
|
|
|
|
+ $invoiceForm = $this->get_args ( 'invoiceForm' )&&is_numeric($this->get_args ( 'invoiceForm' )) ? $this->get_args ( 'invoiceForm' ) : "0";
|
|
|
+
|
|
|
$invoiceTrain = $this->get_args ( 'invoiceTrain' ) ? $this->get_args ( 'invoiceTrain' ) : "ORDINARY";
|
|
|
$date = $this->get_args ( 'date' ) ? $this->get_args ( 'date' ) : "";
|
|
|
|
|
@@ -4178,6 +4213,12 @@ class InvoiceController extends DooController {
|
|
|
elseif ($invoiceType == 'SPECIAL')
|
|
|
$con .= ' and a.invoiceType=1 ';
|
|
|
|
|
|
+ if($invoiceForm==0){
|
|
|
+ $con .= ' and a.invoiceForm=0 ';
|
|
|
+ }else{
|
|
|
+ $con .= ' and a.invoiceForm=1 ';
|
|
|
+ }
|
|
|
+
|
|
|
$dateArr = explode ( ':', $date );
|
|
|
$D1 = $dateString = '';
|
|
|
$D2 = '';
|
|
@@ -4197,7 +4238,7 @@ class InvoiceController extends DooController {
|
|
|
if (! empty ( $MebSea ))
|
|
|
$con .= ' and ( b.invoiceTitle like "%' . $MebSea . '%" or b.invoiceCompany like "%' . $MebSea . '%" or a.invoiceNo like "%' . $MebSea . '%" )';
|
|
|
|
|
|
- $invoiceTotal = $invoicePaper->getInvoicePaperCount ();
|
|
|
+ $invoiceTotal = $invoicePaper->getInvoicePaperCount ($invoiceForm);
|
|
|
|
|
|
$sql = ' ' . $con;
|
|
|
$limit = $page . ',' . $page_size;
|
|
@@ -4266,6 +4307,8 @@ class InvoiceController extends DooController {
|
|
|
$invoiceNoStart = $this->get_args ( 'invoiceNoStart' ) && is_numeric ( $this->get_args ( 'invoiceNoStart' ) ) ? $this->get_args ( 'invoiceNoStart' ) : 0;
|
|
|
$invoiceNoTotal = $this->get_args ( 'invoiceNoTotal' ) && is_numeric ( $this->get_args ( 'invoiceNoTotal' ) ) ? $this->get_args ( 'invoiceNoTotal' ) : 0;
|
|
|
|
|
|
+ $invoiceForm = $this->get_args ( 'invoiceForm' ) && is_numeric ( $this->get_args ( 'invoiceForm' ) ) ? $this->get_args ( 'invoiceForm' ) : 0;
|
|
|
+
|
|
|
if ($invoiceType != '' && ! empty ( $invoiceCode ) && ! empty ( $invoiceNoStart ) && ! empty ( $invoiceNoTotal )) {
|
|
|
|
|
|
$sum = $invoiceNoStart + $invoiceNoTotal;
|
|
@@ -4281,7 +4324,7 @@ class InvoiceController extends DooController {
|
|
|
Doo::db ()->beginTransaction ();
|
|
|
// 批量存储纸质发票
|
|
|
$date = date ( "Y-m-d H:i:s" );
|
|
|
- $sql = 'INSERT INTO CLD_invoicePaper (invoiceType, invoiceCode,invoiceNo,date)
|
|
|
+ $sql = 'INSERT INTO CLD_invoicePaper (invoiceType, invoiceCode,invoiceNo,date,invoiceForm)
|
|
|
VALUES ';
|
|
|
$paperList = array ();
|
|
|
for($invoiceNoStart; $invoiceNoStart <= $sum - 1; $invoiceNoStart ++) {
|
|
@@ -4290,7 +4333,7 @@ class InvoiceController extends DooController {
|
|
|
$INLENGHT = strlen ( ( int ) $invoiceNoStart ) + $sumLenght;
|
|
|
$var = sprintf ( "%0" . $INLENGHT . "d", $invoiceNoStart );
|
|
|
|
|
|
- $paperSql = '(' . $invoiceType . ',"' . $invoiceCode . '","' . $var . '","' . $date . '")';
|
|
|
+ $paperSql = '(' . $invoiceType . ',"' . $invoiceCode . '","' . $var . '","' . $date . '","'.$invoiceForm.'")';
|
|
|
array_push ( $paperList, $paperSql );
|
|
|
}
|
|
|
|
|
@@ -4300,7 +4343,12 @@ class InvoiceController extends DooController {
|
|
|
|
|
|
Doo::db ()->query ( $sql );
|
|
|
Doo::db ()->commit ();
|
|
|
- return 'invoicePaper';
|
|
|
+ if($invoiceForm==1){
|
|
|
+ return 'invoiceElectronic';
|
|
|
+ }else{
|
|
|
+ return 'invoicePaper';
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
die ( 'illegal request' );
|
|
|
}
|
|
@@ -6977,20 +7025,27 @@ class InvoiceController extends DooController {
|
|
|
<th class="taC" width="150">结算方式</th><td colspan="3">软件销售</td>
|
|
|
</tr>';
|
|
|
$html .= ' </tbody></table>';
|
|
|
- if ($detail ['invoiceType'] == 0)
|
|
|
+ if ($detail ['invoiceType'] == 0){
|
|
|
$html .= '<table class="table table-bordered table-condensed"><tbody>
|
|
|
- <tr><th colspan="4" class="taC">增值税普通发票</th></tr><tr>
|
|
|
+ <tr><th colspan="4" class="taC">增值税普通发票';
|
|
|
+ if($detail ['invoiceForm']==1){
|
|
|
+ $html .= '( <span class="colRed">电子发票</span> )';
|
|
|
+ }
|
|
|
+ $html .= '</th></tr><tr>
|
|
|
<th class="taC" width="150">发票抬头</th><td >' . $detail ['invoiceTitle'] . '</td>
|
|
|
<th class="taC" width="150">纳税人识别码</th><td>' . $detail ['TIN'] . '</td>
|
|
|
</tr>';
|
|
|
- else
|
|
|
+ }else{
|
|
|
$html .= '<table class="table table-bordered table-condensed"><tbody>
|
|
|
- <tr><th colspan="4" class="taC">增值税专用发票</th></tr><tr>
|
|
|
+ <tr><th colspan="4" class="taC">增值税专用发票';
|
|
|
+ if($detail ['invoiceForm']==1){
|
|
|
+ $html .= '( <span class="colRed">电子发票</span> )';
|
|
|
+ }
|
|
|
+ $html .= '</th></tr><tr>
|
|
|
<th class="taC" width="150">单位名称</th><td>' . $detail ['invoiceCompany'] . '</td>
|
|
|
<th class="taC" width="150">纳税人识别码</th><td>' . $detail ['TIN'] . '</td></tr>
|
|
|
-
|
|
|
';
|
|
|
-
|
|
|
+ }
|
|
|
$html .= '<tr>
|
|
|
<th class="taC">注册地址</th><td>' . $detail ['address'] . '</td>
|
|
|
<th class="taC">注册电话</th><td>' . $detail ['phone'] . '</td>
|
|
@@ -7416,7 +7471,11 @@ class InvoiceController extends DooController {
|
|
|
Doo::loadModel ( 'invoice' );
|
|
|
$invoice = new invoice ();
|
|
|
|
|
|
- $invoiceDetail = $invoice->getInvoiceByTitle ( $title, 'FUZZY', " and status=2 and printStatus=1 and untreadStatus=0 and irid='' ", true );
|
|
|
+
|
|
|
+
|
|
|
+ $invoiceDetail = $invoice->getInvoiceByTitle ( $title, 'FUZZY', " and status=2 and printStatus=1 and untreadStatus=0 and (irid='' or irid is null) ", true );
|
|
|
+
|
|
|
+
|
|
|
|
|
|
$invoiceHtml = '';
|
|
|
if (! empty ( $invoiceDetail )) {
|