| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418 | <?php/** * 开票功能控制器 * @author CP * @version 1.0 * @namespace invoice * @package invoiceController */class InvoiceController extends DooController {	public $staff;	public $NEW;	public $data;	private $INVOICEKEY = "APPROVAL";	private $INVOICECOLLECTPATH = "protected/cache/invoiceCollect/";		public function beforeRun($resource, $action) {		Doo::loadModel ( "invoiceManage" );		$invoiceManage = new invoiceManage ();		header ( 'Content-Type:text/html;charset=utf-8' );		$moldList = $invoiceManage->getInvoiceByStaff ( $_COOKIE ["staff"] );		// print_r($moldList);				if (empty ( $moldList )) {			$flag = false;			$uGroups = 'ordinary';			if (Doo::acl ()->isAllowed ( $uGroups, $resource, $action )) {				$flag = true;			}		} else {			$flag = false;			array_push ( $moldList, array (					'mold' => 'ordinary' 			) );			foreach ( $moldList as $value ) {				// echo $value['mold'];				// echo $action;								if (Doo::acl ()->isAllowed ( $value ['mold'], $resource, $action )) {					$flag = true;					break;				}			}		}		/*		 * Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);		 */		// var_dump($flag) ;		if (! $flag)			die ( 'illegal request' );	}				function __construct() {		if (isset ( $_COOKIE ["staff"] )) {			if (! empty ( $_COOKIE ["staff"] )) {				Doo::loadModel ( 'staff' );				$staff = new staff ();								// $invoiceManage								// $uname = $this->auth->getUname();				// if ($uname) {				// $uGroups = $this->users->getUidByname($this->auth->getUname());				// } else {				// $uGroups['groups'] = 'anonymous';				// }				// $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);				// if (!$falg)				// return Doo::conf()->APP_URL;								$this->data['new']=$this->isInvoiceNew();								$this->staff = $staff->getUserByIdList ( $_COOKIE ["staff"] );				return "/";			}		}				Doo::loadCore ( 'uri/DooUriRouter' );		$router = new DooUriRouter ();		$routeRs = $router->execute ( Doo::app ()->route, Doo::conf ()->SUBFOLDER );				if ($routeRs ['1'] != "login") {			header ( 'Content-Type:text/html;charset=utf-8' );			@header ( "Location: /login" );		}	}	function invoice() {		Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadModel ( 'express' );		$express = new express ();		Doo::loadModel ( 'invoiceReceivables' );		$invoiceReceivables = new invoiceReceivables ();		Doo::loadModel ( 'invoiceStatistics' );		$invoiceStatistics = new invoiceStatistics ();				$isMonth = $invoiceStatistics->getStatisticsByMonth ();				$year = date ( "Y" );		$tmp_date = date ( "Ym" );		$tmp_year = substr ( $tmp_date, 0, 4 );		$tmp_mon = substr ( $tmp_date, 4, 2 );		$tmp_forwardmonth = mktime ( 0, 0, 0, $tmp_mon - 1, 1, $tmp_year );		$fm_forward_month = date ( "m", $tmp_forwardmonth );		$path = SITE_PATH . $this->INVOICECOLLECTPATH . "invoiceCollect_" . $year . "_" . $fm_forward_month . ".htm";		$htm = $this->showCache ( $path );				$expressList = $express->getExpressByAll ();		$invoiceList = $invoice->getMyInvoice ( $_COOKIE ["staff"] );				$list = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'], $this->staff [0] ['sid'] );				// print_r($invoiceList);				$this->data ['isMonth'] = $isMonth;		$this->data ['htm'] = $htm;				$this->data ['expressList'] = $expressList;		$this->data ['invoiceList'] = $invoiceList;				$this->data ['receivablesList'] = $list;				$this->data ['memu'] = "invoice";		$this->data ['staff'] = $this->staff;		$this->data ['receiptMemu'] = 'invoice';		$this->render ( "/admin/invoice", $this->data );	}	function invoiceAdd() {		Doo::loadModel ( 'L_category' );		$lCategory = new L_category ();				$category = $lCategory->find ( array (				'asArray' => true 		) );				$this->data ['category'] = $category;				$this->data ['memu'] = "invoice";		$this->data ['staff'] = $this->staff;		$this->data ['receiptMemu'] = 'invoice';		$this->render ( "/admin/invoiceAdd", $this->data );	}		/**	 * 提交一份开票申请,并记录下操作日志	 *	 * @since 1.0.0	 * @var integer cid 办事处ID	 * @var integer invoiceType 发票类型	 * @var integer doPost 是否邮寄	 * @var integer invoicePrice 开票金额	 * @var string invoiceElement 开票内容	 * @var string invoiceTitle 发票抬头	 * @var string invoiceCompany 单位名称	 * @var string TIN 纳税人识别码	 * @var string address 注册地址	 * @var string phone 注册电话	 * @var string bank 开户银行	 * @var string bankAccount 银行账户	 * @var string recipients 收件人	 * @var string recipientsPhone 收件人手机/电话	 * @var string recipientsAddress 收件地址	 * @var string mailItems 邮寄物品	 * @var string remark 备注	 * @return string 返回跳转开票主页路径	 */	function invoiceAddDo() {		$cid = $this->get_args ( 'cid' ) && is_numeric ( $this->get_args ( 'cid' ) ) ? $this->get_args ( 'cid' ) : 0;		$invoiceType = $this->get_args ( 'invoiceType' ) && is_numeric ( $this->get_args ( 'invoiceType' ) ) ? $this->get_args ( 'invoiceType' ) : 0;		$doPost = $this->get_args ( 'doPost' ) && is_numeric ( $this->get_args ( 'doPost' ) ) ? $this->get_args ( 'doPost' ) : 0;		$invoicePrice = $this->get_args ( 'invoicePrice' ) ? $this->get_args ( 'invoicePrice' ) : "";		$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' ) : "";		$TIN = $this->get_args ( 'TIN' ) ? $this->get_args ( 'TIN' ) : "";		$address = $this->get_args ( 'address' ) ? $this->get_args ( 'address' ) : "";		$phone = $this->get_args ( 'phone' ) ? $this->get_args ( 'phone' ) : "";		$bank = $this->get_args ( 'bank' ) ? $this->get_args ( 'bank' ) : "";		$bankAccount = $this->get_args ( 'bankAccount' ) ? $this->get_args ( 'bankAccount' ) : "";		$recipients = $this->get_args ( 'recipients' ) ? $this->get_args ( 'recipients' ) : "";		$recipientsPhone = $this->get_args ( 'recipientsPhone' ) ? $this->get_args ( 'recipientsPhone' ) : "";		$recipientsAddress = $this->get_args ( 'recipientsAddress' ) ? $this->get_args ( 'recipientsAddress' ) : "";				$mailItems = $this->get_args ( 'mailItems' ) ? $this->get_args ( 'mailItems' ) : "";		$remark = $this->get_args ( 'remark' ) ? $this->get_args ( 'remark' ) : "";				if (! empty ( $cid ) && ! empty ( $invoicePrice ) && ! empty ( $invoiceElement )) {			Doo::loadModel ( 'invoice' );			$invoice = new invoice ();			Doo::loadModel ( 'L_category' );			$lCategory = new L_category ();			Doo::loadModel ( 'invoiceManage' );			$invoiceManage = new invoiceManage ();			Doo::loadModel ( 'invoiceOperationLog' );			$invoiceOperationLog = new invoiceOperationLog ();						Doo::loadModel ( 'invoiceStatistics' );			$invoiceStatistics = new invoiceStatistics ();						$categoryDetil = $lCategory->getOne ( array (					'SELECT' => 'title',					'where' => 'cid=' . $cid,					'asArray' => true 			) );						$invoiceManageList = $invoiceManage->getInvoiceByAll ();			$invoiceManageDetail = $invoiceManage->getInvoiceByMold ( "发票审批" );						$moldManage = array ();			foreach ( $invoiceManageList as $key => $value ) {				if ($value ['mold'] == '发票打印')					$moldManage [$value ['mold']] = $value ['staffList'];				elseif ($value ['mold'] == '发票邮寄')					$moldManage [$value ['mold']] = $value ['staffList'];				elseif ($value ['mold'] == '发票退票')					$moldManage [$value ['mold']] = $value ['staffList'];			}						$item = array (					'cid' => $cid,					'categoryName' => $categoryDetil ['title'],					'invoiceElement' => $invoiceElement,					'invoicePrice' => $invoicePrice,					'invoiceType' => $invoiceType,					'doPost' => $doPost,					'status' => 1,					'invoiceSerial' => "#F" . date ( "Ymd" ) . mt_rand ( 1000, 9999 ),					'date' => date ( "Y-m-d H:i:s" ),					'updateTime' => date ( "Y-m-d H:i:s" ),					'sid' => $this->staff [0] ['sid'],					'userName' => $this->staff [0] ['username'],					'invoiceManage' => $invoiceManageDetail ['staff'],					'pendingApprovals' => $invoiceManageDetail ['staffList'] [0] [0],					'moldManage' => json_encode ( $moldManage ),					'remark' => $remark 			);			if ($invoiceType == 0)				$item += array (						'invoiceTitle' => $invoiceTitle 				);			else {				$item += array (						'invoiceCompany' => $invoiceCompany,						'TIN' => $TIN,						'address' => $address,						'phone' => $phone,						'bank' => $bank,						'bankAccount' => $bankAccount 				);			}			if ($doPost == 1) {				$item += array (						'recipients' => $recipients,						'recipientsPhone' => $recipientsPhone,						'recipientsAddress' => $recipientsAddress,						'mailItems' => $mailItems 				);			}						$iid = $invoice->addInvoice ( $item );						$item = array (					'date' => date ( "Y-m-d H:i:s" ),					'operation' => "创建",					'status' => 1,					'img' => $this->staff [0] ['avatar'],					'username' => $this->staff [0] ['username'],					'uid' => $this->staff [0] ['sid'],					'category' => $this->staff [0] ['category'],					'iid' => $iid 			);			$invoiceOperationLog->setInvoiceOperationLog ( $item );			$item = array (					'date' => date ( "Y-m-d H:i:s" ),					'operation' => "提交审批",					'status' => 1,					'img' => $this->staff [0] ['avatar'],					'username' => $this->staff [0] ['username'],					'uid' => $this->staff [0] ['sid'],					'category' => $this->staff [0] ['category'],					'iid' => $iid 			);			$invoiceOperationLog->setInvoiceOperationLog ( $item );						$item = array (					'date' => date ( "Y-m-d H:i:s" ),					'priceClass' => 1,					'cid' => $this->staff [0] ['cid'],					'staff' => $this->staff [0] ['sid'],					'invoicePrice' => $invoicePrice 			);			$invoiceStatistics->setInvoiceStatisticsByCondition ( $item );		}				return "/invoice";	}	function invoiceEdit() {		Doo::loadClass ( 'XDeode' );		$XDeode = new XDeode ( 5 );				$iid = isset ( $this->params ['iid'] ) ? $this->params ['iid'] : "";		$iid = $XDeode->decode ( $iid );		if (! is_numeric ( $iid ))			die ( 'illegal request' );				Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadModel ( 'invoiceOperationLog' );		$invoiceOperationLog = new invoiceOperationLog ();				$invoiceDetail = $invoice->getInvoiceByIid ( $iid );		$operation = $invoiceOperationLog->getInvoiceOperationByDropped ( $iid );				$this->data ['operation'] = $operation;		$this->data ['invoiceDetail'] = $invoiceDetail;		$this->data ['memu'] = "invoice";		$this->data ['staff'] = $this->staff;		$this->data ['receiptMemu'] = 'invoice';		$this->render ( "/admin/invoiceEdit", $this->data );	}	/**	 * 重新编辑退回的发票	 * @return string	 */	function invoiceEditDo() {		$iidKey = $this->get_args ( 'iidKey' ) ? $this->get_args ( 'iidKey' ) : '';		Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		$iid = $invoice->authcode ( $iidKey );		if (! empty ( $iid ) && ! is_numeric ( $iid ))			die ( 'illegal request' );				$cid = $this->get_args ( 'cid' ) ? $this->get_args ( 'cid' ) : 0;		$invoiceType = $this->get_args ( 'invoiceType' ) && is_numeric ( $this->get_args ( 'invoiceType' ) ) ? $this->get_args ( 'invoiceType' ) : 0;		$doPost = $this->get_args ( 'doPost' ) && is_numeric ( $this->get_args ( 'doPost' ) ) ? $this->get_args ( 'doPost' ) : 0;		$invoicePrice = $this->get_args ( 'invoicePrice' ) ? $this->get_args ( 'invoicePrice' ) : "";		$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' ) : "";		$TIN = $this->get_args ( 'TIN' ) ? $this->get_args ( 'TIN' ) : "";		$address = $this->get_args ( 'address' ) ? $this->get_args ( 'address' ) : "";		$phone = $this->get_args ( 'phone' ) ? $this->get_args ( 'phone' ) : "";		$bank = $this->get_args ( 'bank' ) ? $this->get_args ( 'bank' ) : "";		$bankAccount = $this->get_args ( 'bankAccount' ) ? $this->get_args ( 'bankAccount' ) : "";		$recipients = $this->get_args ( 'recipients' ) ? $this->get_args ( 'recipients' ) : "";		$recipientsPhone = $this->get_args ( 'recipientsPhone' ) ? $this->get_args ( 'recipientsPhone' ) : "";		$recipientsAddress = $this->get_args ( 'recipientsAddress' ) ? $this->get_args ( 'recipientsAddress' ) : "";				$mailItems = $this->get_args ( 'mailItems' ) ? $this->get_args ( 'mailItems' ) : "";		$remark = $this->get_args ( 'remark' ) ? $this->get_args ( 'remark' ) : "";				if (! empty ( $cid ) && ! empty ( $invoicePrice ) && ! empty ( $invoiceElement ) && ! empty ( $iid )) {						Doo::loadModel ( 'invoiceManage' );			$invoiceManage = new invoiceManage ();			Doo::loadModel ( 'invoiceOperationLog' );			$invoiceOperationLog = new invoiceOperationLog ();						$cid = explode ( ':', $cid );						$invoiceManageList = $invoiceManage->getInvoiceByAll ();			$invoiceManageDetail = $invoiceManage->getInvoiceByMold ( "发票审批" );						$moldManage = array ();			foreach ( $invoiceManageList as $key => $value ) {				if ($value ['mold'] == '发票打印')					$moldManage [$value ['mold']] = $value ['staffList'];				elseif ($value ['mold'] == '发票邮寄')					$moldManage [$value ['mold']] = $value ['staffList'];				elseif ($value ['mold'] == '发票打印')					$moldManage [$value ['mold']] = $value ['staffList'];			}						$item = array (					'iid' => $iid,					'cid' => $cid [0],					'categoryName' => $cid [1],					'invoiceElement' => $invoiceElement,					'invoicePrice' => $invoicePrice,					'invoiceType' => $invoiceType,					'doPost' => $doPost,					'status' => 1,					'updateTime' => date ( "Y-m-d H:i:s" ),					'remark' => $remark 			);			if ($invoiceType == 0)				$item += array (						'invoiceTitle' => $invoiceTitle 				);			else {				$item += array (						'invoiceCompany' => $invoiceCompany,						'TIN' => $TIN,						'address' => $address,						'phone' => $phone,						'bank' => $bank,						'bankAccount' => $bankAccount 				);			}			if ($doPost == 1) {				$item += array (						'recipients' => $recipients,						'recipientsPhone' => $recipientsPhone,						'recipientsAddress' => $recipientsAddress,						'mailItems' => $mailItems 				);			}			$invoice->setInvoiceByCondition ( $item );						$item = array (					'date' => date ( "Y-m-d H:i:s" ),					'operation' => "重新提交审批",					'status' => 1,					'img' => $this->staff [0] ['avatar'],					'username' => $this->staff [0] ['username'],					'uid' => $this->staff [0] ['sid'],					'category' => $this->staff [0] ['category'],					'iid' => $iid 			);			$invoiceOperationLog->setInvoiceOperationLog ( $item );		}				return "/invoice";	}		/**	 * 终止开票	 */	function invoiceDroppedDo() {		$droppedIidKey = $this->get_args ( 'droppedIidKey' ) ? $this->get_args ( 'droppedIidKey' ) : '';		Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadModel ( 'invoiceOperationLog' );		$invoiceOperationLog = new invoiceOperationLog ();				$iid = $invoice->authcode ( $droppedIidKey );		if (! empty ( $iid ) && ! is_numeric ( $iid ))			die ( 'illegal request' );				$item = array (				'iid' => $iid,				'status' => 4,				'updateTime' => date ( "Y-m-d H:i:s" ) 		);		$invoice->setInvoiceByCondition ( $item );		$item = array (				'date' => date ( "Y-m-d H:i:s" ),				'operation' => '终止了开票',				'status' => 4,				'img' => $this->staff [0] ['avatar'],				'username' => $this->staff [0] ['username'],				'uid' => $this->staff [0] ['sid'],				'category' => $this->staff [0] ['category'],				'iid' => $iid 		);		$invoiceOperationLog->setInvoiceOperationLog ( $item );		return "/invoice";	}	/**	 * 申请退票	 */	function invoiceUntreadDo() {		$untreadIidKey = $this->get_args ( 'untreadIidKey' ) ? $this->get_args ( 'untreadIidKey' ) : '';		$untreadReason = $this->get_args ( 'untreadReason' ) ? $this->get_args ( 'untreadReason' ) : "";		$untreadPost = $this->get_args ( 'untreadPost' ) ? $this->get_args ( 'untreadPost' ) : "";		$untreadCompany = $this->get_args ( 'untreadCompany' ) ? $this->get_args ( 'untreadCompany' ) : "";		$untreadNumber = $this->get_args ( 'untreadNumber' ) ? $this->get_args ( 'untreadNumber' ) : "";		$untreadItems = $this->get_args ( 'untreadItems' ) ? $this->get_args ( 'untreadItems' ) : "";				Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadModel ( 'invoiceOperationLog' );		$invoiceOperationLog = new invoiceOperationLog ();		Doo::loadModel ( 'invoiceReceivables' );		$invoiceReceivables = new invoiceReceivables ();				$iid = $invoice->authcode ( $untreadIidKey );		if (! empty ( $iid ) && ! is_numeric ( $iid ))			die ( 'illegal request' );				$lt = $invoiceReceivables->getInvoiceReceivablesByIid ( $iid );				if (! empty ( $lt )) {			header ( 'Content-Type:text/html;charset=utf-8' );			die ( '该发票有收款绑定,请先移除!' );		}				$item = array (				'iid' => $iid,				'untreadStatus' => 1,				'untreadReason' => $untreadReason,				'untreadPost' => $untreadPost,				'updateTime' => date ( "Y-m-d H:i:s" ) 		);		if ($untreadPost == 1) {			$item += array (					'untreadCompany' => $untreadCompany,					'untreadNumber' => $untreadNumber,					'untreadItems' => $untreadItems 			);		}		$invoice->setInvoiceByCondition ( $item );		$item = array (				'date' => date ( "Y-m-d H:i:s" ),				'operation' => '申请退票',				'status' => 7,				'img' => $this->staff [0] ['avatar'],				'username' => $this->staff [0] ['username'],				'uid' => $this->staff [0] ['sid'],				'category' => $this->staff [0] ['category'],				'iid' => $iid 		);		$invoiceOperationLog->setInvoiceOperationLog ( $item );				return "/invoice";	}		/**	 * 删除已终止的开票	 */	function invoiceDelDo() {		Doo::loadClass ( 'XDeode' );		$XDeode = new XDeode ( 5 );		Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadModel ( 'invoiceOperationLog' );		$invoiceOperationLog = new invoiceOperationLog ();				$iid = isset ( $this->params ['iid'] ) ? $this->params ['iid'] : "";		$iid = $XDeode->decode ( $iid );				if (! is_numeric ( $iid ))			die ( 'illegal request' );		$invoiceDetail = $invoice->getMyInvoice ( $_COOKIE ["staff"], $iid );		if (empty ( $invoiceDetail ))			die ( 'illegal request' );		$item = array (				'iid' => $iid,				'isDelete' => 1,				'updateTime' => date ( "Y-m-d H:i:s" ) 		);		$invoice->setInvoiceByCondition ( $item );		$item = array (				'date' => date ( "Y-m-d H:i:s" ),				'operation' => '删除了已终止的发票',				'status' => 4,				'img' => $this->staff [0] ['avatar'],				'username' => $this->staff [0] ['username'],				'uid' => $this->staff [0] ['sid'],				'category' => $this->staff [0] ['category'],				'iid' => $iid 		);		$invoiceOperationLog->setInvoiceOperationLog ( $item );		return "/invoice";	}	function invoiceApproval() {		Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadClass ( 'XDeode' );		$XDeode = new XDeode ( 5 );		Doo::loadModel ( 'staff' );		$staff = new staff ();				$invoiceList = $invoice->find ( array (				'where' => 'status=1 and pendingApprovals=' . $this->staff [0] ['sid'],				'desc' => 'iid',				'asArray' => true 		) );		foreach ( $invoiceList as $key => $value ) {			$invoiceList [$key] ['iidKey'] = $XDeode->encode ( $value ['iid'] );						$lastApprover = json_decode ( $value ['processApprovals'], true );			if (! empty ( $lastApprover )) {				$lastApproverKey = array_keys ( $lastApprover );				$lastApprover = end ( $lastApprover );								$staffDetail = $staff->getOne ( array (						'where' => 'sid=' . end ( $lastApproverKey ),						'asArray' => true 				) );				$lastApprover ['username'] = $staffDetail ['username'];			}			$invoiceList [$key] ['lastApprover'] = $lastApprover;		}				$ilist = $invoice->getInvoiceByProcessStatus ();				// print_r($ilist);				$this->data ['invoiceList'] = $invoiceList;		$this->data ['ilist'] = $ilist;		$this->data ['memu'] = "invoice";		$this->data ['staff'] = $this->staff;		$this->data ['receiptMemu'] = 'invoiceApproval';		$this->render ( "/admin/invoiceApproval", $this->data );	}	function invoiceDetail() {		Doo::loadClass ( 'XDeode' );		$XDeode = new XDeode ( 5 );				$iid = isset ( $this->params ['iid'] ) ? $this->params ['iid'] : "";		$iid = $XDeode->decode ( $iid );		if (! is_numeric ( $iid ))			die ( 'illegal request' );				Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadModel ( 'invoiceOperationLog' );		$invoiceOperationLog = new invoiceOperationLog ();				$invoiceDetail = $invoice->getOne ( array (				'where' => 'status=1 and pendingApprovals=' . $this->staff [0] ['sid'] . ' and iid=' . $iid,				'asArray' => true 		) );		$invoiceOperationLogList = $invoiceOperationLog->getInvoiceOperationLogByIid ( $iid );				$this->data ['invoiceDetail'] = $invoiceDetail;		$this->data ['invoiceOperationLogList'] = $invoiceOperationLogList;		$this->data ['INVOICEKEY'] = $invoice->authcode ( $invoiceDetail ['iid'], '' );		$this->data ['memu'] = "invoice";		$this->data ['staff'] = $this->staff;		$this->data ['receiptMemu'] = 'invoiceApproval';		$this->render ( "/admin/invoiceApprovalDetail", $this->data );	}		/**	 * 对发票进行审批,其中操作有终止,退回,同意动作。操作成功并记录下操作日志	 *	 * @since 1.0.0	 * @var integer iid 开票ID 已加密	 * @var integer status 发票审批状态	 * @var integer opintion 审批发票的意见	 * @return string 如操作成功返回审批首页	 */	function invoiceApprovalDo() {		Doo::loadModel ( 'invoice' );		$invoice = new invoice ();				$iid = $this->get_args ( 'invoiceKey' ) ? $this->get_args ( 'invoiceKey' ) : "";		$status = $this->get_args ( 'status' ) && is_numeric ( $this->get_args ( 'status' ) ) ? $this->get_args ( 'status' ) : 0;		$opinion = $this->get_args ( 'opinion' ) ? $this->get_args ( 'opinion' ) : "";		$iid = $invoice->authcode ( $iid );		if (! is_numeric ( $iid ))			die ( 'illegal request' );				if (! empty ( $iid ) && ! empty ( $status ) && ! empty ( $opinion )) {			if (! ($status == 2 || $status == 3 || $status == 4))				die ( 'illegal request' );						Doo::loadModel ( 'invoiceOperationLog' );			$invoiceOperationLog = new invoiceOperationLog ();						$invoiceDetail = $invoice->getOne ( array (					'where' => 'status=1 and iid=' . $iid . ' and pendingApprovals=' . $this->staff [0] ['sid'],					'asArray' => true 			) );			if (empty ( $invoiceDetail ))				die ( 'illegal request' );						$processApprovals = json_decode ( $invoiceDetail ['processApprovals'], true );			$invoiceManage = json_decode ( $invoiceDetail ['invoiceManage'], true );						if ($status == 3) {				$invoice->status = $status;				$item = array (						'operation' => $opinion 				);			} else {				if (empty ( $processApprovals )) {					$processApprovals = array (							$this->staff [0] ['sid'] => array (									'date' => date ( "Y-m-d H:i:s" ),									'opinion' => $opinion,									'status' => $status 							) 					);					if ($status != 4 && isset ( $invoiceManage [1] ))						$invoice->pendingApprovals = $invoiceManage [1] [0];					$invoice->processApprovals = json_encode ( $processApprovals );				} else {					$processApprovals [$this->staff [0] ['sid']] = array (							'date' => date ( "Y-m-d H:i:s" ),							'opinion' => $opinion,							'status' => $status 					);										$pendingApprovals = 0;					foreach ( $invoiceManage as $key => $value ) {						if ($value [0] == $this->staff [0] ['sid']) {							if (isset ( $invoiceManage [$key + 1] ))								$pendingApprovals = $invoiceManage [$key + 1] [0];							break;						}					}										if ($status != 4 && ! empty ( $pendingApprovals ))						$invoice->pendingApprovals = $pendingApprovals;					$invoice->processApprovals = json_encode ( $processApprovals );				}								$item = array (						'operation' => $opinion 				);				if (count ( $processApprovals ) == count ( $invoiceManage ) && $status != 4) {					$invoice->status = $status;					$invoice->pendingApprovals = 0;				} elseif ($status == 4) {					$invoice->status = $status;					$item = array (							'operation' => $opinion 					);				}			}			$invoice->updateTime = date ( "Y-m-d H:i:s" );			$invoice->update ( array (					'where' => 'iid=' . $iid 			) );						$item += array (					'date' => date ( "Y-m-d H:i:s" ),					'img' => $this->staff [0] ['avatar'],					'username' => $this->staff [0] ['username'],					'uid' => $this->staff [0] ['sid'],					'category' => $this->staff [0] ['category'],					'status' => $status,					'iid' => $iid 			);			$invoiceOperationLog->setInvoiceOperationLog ( $item );						return '/invoiceApproval';		}		die ( 'illegal request' );	}		/**	 * 展示需要打印的发票数据	 *	 * @since 1.0.0	 */	function invoicePrint() {		Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadClass ( 'XDeode' );		$XDeode = new XDeode ( 5 );		Doo::loadModel ( 'staff' );		$staff = new staff ();				$toPrint = $invoice->getPrintInvoiceByManage ( $this->staff [0] ['sid'], 0 );		$printed = $invoice->getPrintInvoiceByManage ( $this->staff [0] ['sid'], 1 );				foreach ( $toPrint as $key => $value ) {			$toPrint [$key] ['iidKey'] = $XDeode->encode ( $value ['iid'] );						$lastApprover = json_decode ( $value ['processApprovals'], true );			if (! empty ( $lastApprover )) {				$lastApproverKey = array_keys ( $lastApprover );				$lastApprover = end ( $lastApprover );								$staffDetail = $staff->getOne ( array (						'where' => 'sid=' . end ( $lastApproverKey ),						'asArray' => true 				) );				$lastApprover ['username'] = $staffDetail ['username'];			}			$toPrint [$key] ['lastApprover'] = $lastApprover;		}				foreach ( $printed as $key => $value ) {			$printed [$key] ['iidKey'] = $XDeode->encode ( $value ['iid'] );						$lastApprover = json_decode ( $value ['processApprovals'], true );			if (! empty ( $lastApprover )) {				$lastApproverKey = array_keys ( $lastApprover );				$lastApprover = end ( $lastApprover );								$staffDetail = $staff->getOne ( array (						'where' => 'sid=' . end ( $lastApproverKey ),						'asArray' => true 				) );				$lastApprover ['username'] = $staffDetail ['username'];			}			$printed [$key] ['lastApprover'] = $lastApprover;		}				$this->data ['printed'] = $printed;		$this->data ['toPrint'] = $toPrint;				$this->data ['memu'] = "invoice";		$this->data ['staff'] = $this->staff;		$this->data ['receiptMemu'] = 'invoicePrint';		$this->render ( "/admin/invoicePrint", $this->data );	}	/**	 * 展示发票打印的详情页面	 *	 * @since 1.0.0	 */	function invoicePrintDetail() {		Doo::loadClass ( 'XDeode' );		$XDeode = new XDeode ( 5 );				$iid = isset ( $this->params ['iid'] ) ? $this->params ['iid'] : "";		$iid = $XDeode->decode ( $iid );		if (! is_numeric ( $iid ))			die ( 'illegal request' );				Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadModel ( 'invoiceOperationLog' );		$invoiceOperationLog = new invoiceOperationLog ();				$invoiceDetail = $invoice->getPrintInvoiceByManage ( $this->staff [0] ['sid'], 0, $iid );		// if (empty ( $invoiceDetail ))		// die ( 'illegal request' );				$invoiceOperationLogList = $invoiceOperationLog->getInvoiceOperationLogByIid ( $iid );				$this->data ['invoiceDetail'] = $invoiceDetail;		$this->data ['invoiceOperationLogList'] = $invoiceOperationLogList;		$this->data ['INVOICEKEY'] = $invoice->authcode ( $invoiceDetail ['iid'], '' );		$this->data ['memu'] = "invoice";		$this->data ['staff'] = $this->staff;		$this->data ['receiptMemu'] = 'invoicePrint';		$this->render ( "/admin/invoicePrintDetail", $this->data );	}	/**	 * 填写票号并完成打印	 * @since 1.0.0	 */	function invoicePrintDo() {		Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		$iid = $this->get_args ( 'invoiceKey' ) ? $this->get_args ( 'invoiceKey' ) : "";		$invoiceNo = $this->get_args ( 'invoiceNo' ) ? $this->get_args ( 'invoiceNo' ) : "";				$iid = $invoice->authcode ( $iid );		if (! is_numeric ( $iid ))			die ( 'illegal request' );		if (! empty ( $iid ) && ! empty ( $invoiceNo )) {						Doo::loadModel ( 'invoiceOperationLog' );			$invoiceOperationLog = new invoiceOperationLog ();						$invoicePrintDetail = $invoice->getInvoiceByPrint ( $iid );			if (empty ( $invoicePrintDetail ))				die ( 'illegal request' );			$item = array (					'iid' => $iid,					'printStatus' => 1,					'updateTime' => date ( "Y-m-d H:i:s" ),					'printTime' => date ( "Y-m-d H:i:s" ),					'invoiceNo' => $invoiceNo 			);			$invoice->setInvoiceByCondition ( $item );			$item = array (					'date' => date ( "Y-m-d H:i:s" ),					'operation' => $invoiceNo,					'status' => 5,					'img' => $this->staff [0] ['avatar'],					'username' => $this->staff [0] ['username'],					'uid' => $this->staff [0] ['sid'],					'category' => $this->staff [0] ['category'],					'iid' => $iid 			);			$invoiceOperationLog->setInvoiceOperationLog ( $item );			return "/invoicePrint";		}	}	/**	 * 需要邮寄的发票	 * @since 1.0.0	 */	function invoicePost() {		Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadModel ( 'express' );		$express = new express ();				$invoicePost = $invoice->getPostByInvoice ();		$invoicePosted = $invoice->getPostByInvoice ( 1 );		$expressList = $express->getExpressByAll ();				$this->data ['expressList'] = $expressList;		$this->data ['invoicePost'] = $invoicePost;		$this->data ['invoicePosted'] = $invoicePosted;		$this->data ['memu'] = "invoice";		$this->data ['staff'] = $this->staff;		$this->data ['receiptMemu'] = 'invoicePost';		$this->render ( "/admin/invoicePost", $this->data );	}	/**	 * 添加发票邮寄信息	 */	function invoiceExpressAddDo() {		Doo::loadModel ( 'invoice' );		$invoice = new invoice ();				$iid = $this->get_args ( 'iidKey' ) ? $this->get_args ( 'iidKey' ) : "";		$expressCompany = $this->get_args ( 'express' ) ? $this->get_args ( 'express' ) : "";		$expressNumber = $this->get_args ( 'nu' ) ? $this->get_args ( 'nu' ) : "";		$actualItems = $this->get_args ( 'actualItems' ) ? $this->get_args ( 'actualItems' ) : "";		$iid = $iid = $invoice->authcode ( $iid );		if (! is_numeric ( $iid ) && empty ( $expressCompany ) && empty ( $expressNumber ) && empty ( $actualItems ))			die ( 'illegal request' );				$item = array (				'iid' => $iid,				'postStatus' => 1,				'updateTime' => date ( "Y-m-d H:i:s" ),				'postTime' => date ( "Y-m-d H:i:s" ),				'expressCompany' => $expressCompany,				'expressNumber' => $expressNumber,				'actualItems' => $actualItems,				'poster' => $this->staff [0] ['username'] 		);		$invoice->setInvoiceByCondition ( $item );		return '/invoicePost';	}	/**	 * 退票处理页面	 */	function invoiceUntread() {		Doo::loadModel ( 'invoice' );		$invoice = new invoice ();				$untreadInvoice = $invoice->getInvoiceByUntreadStatus ( 1 );		$establishedInvoice = $invoice->getInvoiceByUntreadStatus ( 2 );				$this->data ['untreadInvoice'] = $untreadInvoice;		$this->data ['establishedInvoice'] = $establishedInvoice;				$this->data ['memu'] = "invoice";		$this->data ['staff'] = $this->staff;		$this->data ['receiptMemu'] = 'invoiceUntread';		$this->render ( "/admin/invoiceUntread", $this->data );	}		/**	 * 确认收到退回的发票,开票状态为退回	 */	function invoiceUntreadEstablishedDo() {		$untreadIidKey = $this->get_args ( 'untreadIidKey' ) ? $this->get_args ( 'untreadIidKey' ) : '';				Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadModel ( 'invoiceOperationLog' );		$invoiceOperationLog = new invoiceOperationLog ();				$iid = $invoice->authcode ( $untreadIidKey );		if (! empty ( $iid ) && ! is_numeric ( $iid ))			die ( 'illegal request' );				$item = array (				'iid' => $iid,				'untreadStatus' => 2,				'updateTime' => date ( "Y-m-d H:i:s" ) 		);				$invoice->setInvoiceByCondition ( $item );		$item = array (				'date' => date ( "Y-m-d H:i:s" ),				'operation' => '已确认退票',				'status' => 6,				'img' => $this->staff [0] ['avatar'],				'username' => $this->staff [0] ['username'],				'uid' => $this->staff [0] ['sid'],				'category' => $this->staff [0] ['category'],				'iid' => $iid 		);		$invoiceOperationLog->setInvoiceOperationLog ( $item );				return "/invoiceUntread";	}	function invoiceReceivables() {		Doo::loadModel ( 'L_category' );		$lCategory = new L_category ();		Doo::loadModel ( 'staff' );		$staff = new staff ();		Doo::loadModel ( 'invoiceReceivables' );		$invoiceReceivables = new invoiceReceivables ();				$category = $lCategory->getCategory ();		$staffList = $staff->getStaffByCid ( $this->staff [0] ['cid'] );				$receivablesList = $invoiceReceivables->getInvoiceReceivablesByNew ();		// print_r($receivablesList);				$this->data ['receivablesList'] = $receivablesList;		$this->data ['staffList'] = $staffList;		$this->data ['category'] = $category;				$this->data ['memu'] = "invoice";		$this->data ['staff'] = $this->staff;		$this->data ['receiptMemu'] = 'invoiceReceivables';		$this->render ( "/admin/invoiceReceivables", $this->data );	}		/**	 * 录入收款数据	 * @return string	 */	function invoiceReceivablesDo() {		$receivablesPrice = $this->get_args ( 'receivablesPrice' ) ? $this->get_args ( 'receivablesPrice' ) : "";		$receivablesMessage = $this->get_args ( 'receivablesMessage' ) ? $this->get_args ( 'receivablesMessage' ) : "";		$receivablesBank = $this->get_args ( 'receivablesBank' ) ? $this->get_args ( 'receivablesBank' ) : "";		$receivablesDate = $this->get_args ( 'receivablesDate' ) ? $this->get_args ( 'receivablesDate' ) : "";		$receivablesCategory = $this->get_args ( 'receivablesCategory' ) ? $this->get_args ( 'receivablesCategory' ) : "";		$receivablesStaff = $receivablesStaff2 = $this->get_args ( 'receivablesStaff' ) ? $this->get_args ( 'receivablesStaff' ) : "";				Doo::loadModel ( 'invoiceReceivables' );		$invoiceReceivables = new invoiceReceivables ();		Doo::loadModel ( 'invoiceROLog' );		$invoiceROLog = new invoiceROLog ();		Doo::loadModel ( 'invoiceStatistics' );		$invoiceStatistics = new invoiceStatistics ();				if (! empty ( $receivablesPrice ) && ! empty ( $receivablesMessage ) && ! empty ( $receivablesBank ) && ! empty ( $receivablesDate ) && ! empty ( $receivablesCategory ) && ! empty ( $receivablesStaff )) {						$item = array (					'receivablesPrice' => $receivablesPrice,					'receivablesMessage' => $receivablesMessage,					'receivablesSerial' => "#SK" . date ( "Ymd" ) . mt_rand ( 1000, 9999 ),					'receivablesBank' => $receivablesBank,					'receivablesDate' => $receivablesDate,					'inputStaff' => $this->staff [0] ['username'],					'date' => date ( "Y-m-d" ),					'receivablesCategory' => $receivablesCategory,					'receivablesStaff' => $receivablesStaff 			);			$irid = $invoiceReceivables->addInvoiceReceivables ( $item );						// 收款操作日志			if ($receivablesCategory == 'PUBLIC' && $receivablesStaff == 'PUBLIC')				$item = array (						'operation' => $this->staff [0] ['username'] . " 转入 公共待认领款项 " 				);			elseif ($receivablesCategory != 'PUBLIC' && $receivablesStaff == 'PUBLIC')				$item = array (						'operation' => $this->staff [0] ['username'] . "转入 办事处待认领款项" 				);			elseif ($receivablesCategory != 'PUBLIC' && $receivablesStaff != 'PUBLIC') {				$receivablesStaff = explode ( '-', $receivablesStaff );				$item = array (						'operation' => $this->staff [0] ['username'] . " 转入 " . $receivablesStaff [1],						'bindDate' => date ( "Y-m-d H:i:s" ) 				);			}			$item += array (					'date' => date ( "Y-m-d" ),										'status' => 1,					'img' => $this->staff [0] ['avatar'],					'username' => $this->staff [0] ['username'],					'uid' => $this->staff [0] ['sid'],					'category' => $this->staff [0] ['category'],					'irid' => $irid 			);			$invoiceROLog->setInvoiceROLog ( $item );						$item = array (					'date' => date ( "Y-m-d H:i:s" ),					'priceClass' => 2,					'irid' => $irid,					'receivablesPrice' => $receivablesPrice 			);			if ($receivablesCategory != 'PUBLIC') {				$receivablesCategory = explode ( ":", $receivablesCategory );				$item += array (						'cid' => $receivablesCategory [0] 				);			}						if ($receivablesStaff2 != 'PUBLIC') {				$receivablesStaff = explode ( "-", $receivablesStaff2 );				$item += array (						'staff' => $receivablesStaff [0] 				);			}			$invoiceStatistics->setInvoiceStatisticsByCondition ( $item );		}				return "/invoiceReceivables";	}	/**	 * 收款认领页面-包括公共认领 办事处认领 最近已认领数据	 */	function invoiceReceivablesClaim() {		Doo::loadModel ( 'invoiceReceivables' );		$invoiceReceivables = new invoiceReceivables ();				$receivablesList = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'] );				$this->data ['receivablesList'] = $receivablesList;				$this->data ['memu'] = "invoice";		$this->data ['staff'] = $this->staff;		$this->data ['receiptMemu'] = 'invoiceReceivablesClaim';		$this->render ( "/admin/invoiceReceivablesClaim", $this->data );	}		/**	 * 管理员录入的收款 ,确认认领到谁的名下.统计收款金额	 */	function invoiceReceivablesAscription() {		$irid = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";		Doo::loadModel ( 'invoiceReceivables' );		$invoiceReceivables = new invoiceReceivables ();		Doo::loadModel ( 'invoiceROLog' );		$invoiceROLog = new invoiceROLog ();		Doo::loadModel ( 'invoiceStatistics' );		$invoiceStatistics = new invoiceStatistics ();				$detail = $invoiceReceivables->getInvoiceReceivablesByIrid ( $irid );				if (! empty ( $detail ) && $detail ['receivablesStaff'] == 'PUBLIC') {			$item = array (					'irid' => $detail ['irid'],					'receivablesCategory' => $this->staff [0] ['cid'] . ":" . $this->staff [0] ['category'],					'receivablesStaff' => $this->staff [0] ['sid'] . "-" . $this->staff [0] ['username'],					'confirmTime' => date ( "Y-m-d H:i:s" ),					'source' => 1 			);			$invoiceReceivables->setInvoiceReceivablesByCondition ( $item );						$item = array (					'date' => date ( "Y-m-d" ),					'operation' => $this->staff [0] ['username'] . " 认领 ",					'status' => 2,					'img' => $this->staff [0] ['avatar'],					'username' => $this->staff [0] ['username'],					'uid' => $this->staff [0] ['sid'],					'category' => $this->staff [0] ['category'],					'irid' => $irid 			);			$invoiceROLog->setInvoiceROLog ( $item );						$item = array (					'cid' => $this->staff [0] ['cid'],					'staff' => $this->staff [0] ['sid'] 			);			$invoiceStatistics->updateInvoiceStatisticsByIrid ( $item, $detail ['irid'] );		}				return "/invoiceReceivablesClaim";	}		/**	 */	function invoiceMyReceivables() {		Doo::loadModel ( 'invoiceReceivables' );		$invoiceReceivables = new invoiceReceivables ();		Doo::loadModel ( 'invoiceStatistics' );		$invoiceStatistics = new invoiceStatistics ();				$isMonth = $invoiceStatistics->getStatisticsByMonth ();				$year = date ( "Y" );		$tmp_date = date ( "Ym" );		$tmp_year = substr ( $tmp_date, 0, 4 );		$tmp_mon = substr ( $tmp_date, 4, 2 );		$tmp_forwardmonth = mktime ( 0, 0, 0, $tmp_mon - 1, 1, $tmp_year );		$fm_forward_month = date ( "m", $tmp_forwardmonth );		$path = SITE_PATH . $this->INVOICECOLLECTPATH . "invoiceCollect_" . $year . "_" . $fm_forward_month . ".htm";		$htm = $this->showCache ( $path );				$list = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'], $this->staff [0] ['sid'] );				$this->data ['isMonth'] = $isMonth;		$this->data ['htm'] = $htm;		$this->data ['list'] = $list;				$this->data ['memu'] = "invoice";		$this->data ['staff'] = $this->staff;		$this->data ['receiptMemu'] = 'invoiceMyReceivables';		$this->render ( "/admin/invoiceMyReceivables", $this->data );	}		/**	 * 收款绑定发票 ,一个收款只能绑定一个发票	 */	function invoiceBindReceivables() {		$claimKey = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";		$invoiceKey = $this->get_args ( 'invoiceKey' ) ? $this->get_args ( 'invoiceKey' ) : "";				Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadModel ( 'invoiceReceivables' );		$invoiceReceivables = new invoiceReceivables ();		Doo::loadModel ( 'invoiceOperationLog' );		$invoiceOperationLog = new invoiceOperationLog ();				if (empty ( $invoiceKey ) || empty ( $claimKey ))			die ( 'illegal request' );				$detail = $invoice->getInvoiceByIid ( $invoiceKey );		$detailM = $invoiceReceivables->getInvoiceReceivablesByIrid ( $claimKey );				if (empty ( $detail ) && empty ( $detailM ))			die ( 'illegal request' );						// if ($detailM ['receivablesPrice'] >= $detail ['invoicePrice']) {			// $price = $detailM ['receivablesPrice'] - $detail ['invoicePrice'];			// die ( '<p>收款金额超出开票金额 ¥' . $price . '元,请谨慎操作</p><a href="/invoiceMyReceivables">返回</a>' );			// }				$item = array (				'irid' => $detailM ['irid'],				'bindStatus' => 1,				'iid' => $detail ['iid'],				'bindDate' => date ( "Y-m-d H:i:s" ) 		);		$invoiceReceivables->setInvoiceReceivablesByCondition ( $item );				$iridString = "";		if (empty ( $detail ['irid'] ))			$iridString = $detailM ['irid'];		else			$iridString = $detail ['irid'] . ',' . $detailM ['irid'];		$item = array (				'iid' => $detail ['iid'],				'irid' => $iridString 		);		$invoice->setInvoiceByCondition ( $item );				// 操作日志		$item = array (				'date' => date ( "Y-m-d H:i:s" ),				'operation' => "收款" . $detailM ['receivablesSerial'] . "入账到发票" . $detail ['invoiceSerial'],				'status' => 8,				'img' => $this->staff [0] ['avatar'],				'username' => $this->staff [0] ['username'],				'uid' => $this->staff [0] ['sid'],				'category' => $this->staff [0] ['category'],				'iid' => $detail ['iid'] 		);		$invoiceOperationLog->setInvoiceOperationLog ( $item );				return "/invoiceMyReceivables";	}		/**	 * 发票收款完成	 */	function invoiceEnterReceivables() {		$invoiceKey = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";		// $invoiceClaim = $this->get_args ( 'invoiceClaim' ) ? $this->get_args ( 'invoiceClaim' ) : "";				Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadModel ( 'invoiceOperationLog' );		$invoiceOperationLog = new invoiceOperationLog ();		Doo::loadModel ( 'invoiceStatistics' );		$invoiceStatistics = new invoiceStatistics ();		Doo::loadModel ( 'invoiceReceivables' );		$invoiceReceivables = new invoiceReceivables ();				$detail = $invoice->getInvoiceByIid ( $invoiceKey );				if (empty ( $detail ))			die ( 'illegal request' );				$item = array (				'untreadStatus' => 3,				'updateTime' => date ( "Y-m-d H:i:s" ),				'iid' => $detail ['iid'] 		);		$invoice->setInvoiceByCondition ( $item );				// 操作日志		$item = array (				'date' => date ( "Y-m-d H:i:s" ),				'operation' => "发票" . $detail ['invoiceSerial'] . "收款完成",				'status' => 9,				'img' => $this->staff [0] ['avatar'],				'username' => $this->staff [0] ['username'],				'uid' => $this->staff [0] ['sid'],				'category' => $this->staff [0] ['category'],				'iid' => $detail ['iid'] 		);		$invoiceOperationLog->setInvoiceOperationLog ( $item );				$list = $invoiceReceivables->getInvoiceReceivablesInIridString ( $detail ['irid'] );		$accountPrice = 0;		foreach ( $list as $key => $value ) {			$accountPrice += $value ['receivablesPrice'];		}		$item = array (				'date' => date ( "Y-m-d H:i:s" ),				'priceClass' => 3,								'cid' => $this->staff [0] ['cid'],				'staff' => $this->staff [0] ['sid'],				'accountPrice' => $accountPrice 		);		$invoiceStatistics->setInvoiceStatisticsByCondition ( $item );				return "/invoice";	}	function invoiceAggregate() {		$year = $this->get_args ( 'year' ) ? $this->get_args ( 'year' ) : date ( "Y" );				Doo::loadModel ( 'invoiceStatistics' );		$invoiceStatistics = new invoiceStatistics ();		Doo::loadModel ( 'L_category' );		$Lcategory = new L_category ();				$isList = $invoiceStatistics->getInvoiceStatisticsByYear ( $year );		$LcategoryList = $Lcategory->getCategory ();		// print_r($isList);				$html = ""; // $invoicePriceCategory=0;$receivablesPriceCategory=0;$accountPriceCategory=0;		foreach ( $LcategoryList as $key => $value ) {			$html .= '<tr><th><a href="/invoiceAggregateCategory/' . $value ['cidKey'] . '">' . $value ['title'] . '</a></th>';			$month = 1;			$invoicePriceYear = 0;			$receivablesPriceYear = 0;			$accountPriceYear = 0;			for(; $month <= 12; $month ++) {				$flag = true;				foreach ( $isList ['statisticsMonthCid'] as $k => $v ) {					if ($value ['cid'] == $v ['cid'] && $month == $v ['month']) {						$html .= '<td class="taR">¥' . $v ['invoicePrice'] . '</td>								<td class="taR">¥' . $v ['receivablesPrice'] . '</td>								<td class="taR"><b>¥' . $v ['accountPrice'] . '</b></td>								';						$invoicePriceYear += $v ['invoicePrice'];						$receivablesPriceYear += $v ['receivablesPrice'];						$accountPriceYear += $v ['accountPrice'];						$flag = false;						break;					}				}				if ($flag)					$html .= '<td class="taR"></td>								<td class="taR"></td>								<td class="taR"><b></b></td>								';			}			$html .= '<td class="taR colRed">' . $invoicePriceYear . '</td>					<td class="taR colOrange">' . $receivablesPriceYear . '</td>					<td class="taR colGreen"><b>' . $accountPriceYear . '</b></td>								';			$html .= '</tr>';		}				$html .= '<tr><th><b class="colGreen">月合计</b></th>';		$invoicePriceYear = 0;		$receivablesPriceYear = 0;		$accountPriceYear = 0;		for($month = 1; $month <= 12; $month ++) {			$flag = true;			foreach ( $isList ['statisticsMonth'] as $k => $v ) {				if ($month == $v ['month']) {					$html .= '<td class="taR">¥' . $v ['invoicePrice'] . '</td>							<td class="taR">¥' . $v ['receivablesPrice'] . '</td>							<td class="taR"><b>¥' . $v ['accountPrice'] . '</b></td>								';					$invoicePriceYear += $v ['invoicePrice'];					$receivablesPriceYear += $v ['receivablesPrice'];					$accountPriceYear += $v ['accountPrice'];					$flag = false;					break;				}				if ($flag)					$html .= '<td class="taR"></td>								<td class="taR"></td>								<td class="taR"><b></b></td>								';			}		}		$html .= '<td class="taR colRed">' . $invoicePriceYear . '</td>				<td class="taR colOrange">' . $receivablesPriceYear . '</td>				<td class="taR colGreen"><b>' . $accountPriceYear . '</b></td>				';		$html .= '</tr>';				$this->data ['html'] = $html;		$this->data ['LcategoryList'] = $LcategoryList;		$this->data ['isList'] = $isList;				$this->data ['year'] = $year;		$this->data ['memu'] = "invoice";		$this->data ['staff'] = $this->staff;		$this->data ['receiptMemu'] = 'invoiceAggregate';		$this->render ( "/admin/invoiceAggregate", $this->data );	}	function invoiceAggregateStaff() {		$year = $this->get_args ( 'year' ) ? $this->get_args ( 'year' ) : date ( "Y" );				Doo::loadModel ( 'invoiceStatistics' );		$invoiceStatistics = new invoiceStatistics ();		Doo::loadModel ( 'L_category' );		$Lcategory = new L_category ();				$toteList = $invoiceStatistics->getInvoiceStatisticsByTote ( $year );		$staffList = $invoiceStatistics->getInvoiceStatisticsByStaff ( $year );		$cStaff = $Lcategory->getCategoryStaff ();				$html = '';		foreach ( $cStaff as $key => $value ) {			$categoryFir = true;			foreach ( $value ['staff'] as $k => $v ) {				if ($categoryFir) {					$width = count ( $value ['staff'] ) + 1;					$html .= '<tr><th rowspan="' . $width . '">' . $value ['title'] . ' </th>';					$categoryFir = false;				} else					$html .= '<tr>';				$html .= '<th>' . $v ['username'] . '</th>';				$invoicePriceStaffYear = 0;				$receivablesPriceStaffYear = 0;				$accountPriceStaffYear = 0;				for($month = 1; $month <= 12; $month ++) {					$flag = true;					foreach ( $staffList ['statisticsMonthStaff'] as $sl => $slv ) {						if ($v ['sid'] == $slv ['staff'] && $month == $slv ['month']) {							$html .= '<td class="taR">¥' . $slv ['invoicePrice'] . '</td>							<td class="taR">¥' . $slv ['receivablesPrice'] . '</td>							<td class="taR"><b>¥' . $slv ['accountPrice'] . '</b></td>								';							$invoicePriceStaffYear += $slv ['invoicePrice'];							$receivablesPriceStaffYear += $slv ['receivablesPrice'];							$accountPriceStaffYear += $slv ['accountPrice'];							$flag = false;							break;						}					}					if ($flag)						$html .= '<td class="taR"></td>								<td class="taR"></td>								<td class="taR"><b></b></td>								';				}				$html .= '<td class="taR colRed">' . $invoicePriceStaffYear . '</td>					<td class="taR colOrange">' . $receivablesPriceStaffYear . '</td>					<td class="taR colGreen"><b>' . $accountPriceStaffYear . '</b></td>								';			}			$html .= '</tr>';						// 小计			if (! empty ( $value ['staff'] )) {				$html .= '<tr><th class="taR">小计</th>';				$invoicePriceStaffYear = 0;				$receivablesPriceStaffYear = 0;				$accountPriceStaffYear = 0;				for($month = 1; $month <= 12; $month ++) {					$flag = true;					foreach ( $staffList ['statisticsMonthCid'] as $smc => $smcv ) {						if ($value ['cid'] == $smcv ['cid'] && $month == $slv ['month']) {							$html .= '<td class="taR">¥' . $smcv ['invoicePrice'] . '</td>							<td class="taR">¥' . $smcv ['receivablesPrice'] . '</td>							<td class="taR"><b>¥' . $smcv ['accountPrice'] . '</b></td>								';							$invoicePriceStaffYear += $slv ['invoicePrice'];							$receivablesPriceStaffYear += $slv ['receivablesPrice'];							$accountPriceStaffYear += $slv ['accountPrice'];							$flag = false;							break;						}					}					if ($flag)						$html .= '<td class="taR"></td>								<td class="taR"></td>								<td class="taR"><b></b></td>								';				}				$html .= '<td class="taR colRed">' . $invoicePriceStaffYear . '</td>					<td class="taR colOrange">' . $receivablesPriceStaffYear . '</td>					<td class="taR colGreen"><b>' . $accountPriceStaffYear . '</b></td>								';				$html .= '</tr>';			}		}				$html .= '<tr class="warning"><th colspan="2"><b class="colGreen" >月合计</b></th>';		$invoicePriceYear = 0;		$receivablesPriceYear = 0;		$accountPriceYear = 0;		for($month = 1; $month <= 12; $month ++) {			$flag = true;			foreach ( $staffList ['statisticsMonth'] as $k => $v ) {				if ($month == $v ['month']) {					$html .= '<td class="taR colRed">¥' . $v ['invoicePrice'] . '</td>							<td class="taR colOrange">¥' . $v ['receivablesPrice'] . '</td>							<td class="taR colGreen"><b>¥' . $v ['accountPrice'] . '</b></td>								';					$invoicePriceYear += $v ['invoicePrice'];					$receivablesPriceYear += $v ['receivablesPrice'];					$accountPriceYear += $v ['accountPrice'];					$flag = false;					break;				}				if ($flag)					$html .= '<td class="taR"></td>								<td class="taR"></td>								<td class="taR"><b></b></td>								';			}		}		$html .= '<td class="taR colRed">' . $invoicePriceYear . '</td>				<td class="taR colOrange">' . $receivablesPriceYear . '</td>				<td class="taR colGreen"><b>' . $accountPriceYear . '</b></td>				';		$html .= '</tr>';				$this->data ['html'] = $html;		$this->data ['isList'] = $toteList;		$this->data ['year'] = $year;		$this->data ['memu'] = "invoice";		$this->data ['staff'] = $this->staff;		$this->data ['receiptMemu'] = 'invoiceAggregate';		$this->render ( "/admin/invoiceAggregateStaff", $this->data );	}	function invoiceAggregateCategory() {		Doo::loadClass ( 'XDeode' );		$XDeode = new XDeode ( 5 );				$cid = $cidKey = isset ( $this->params ['cid'] ) ? $this->params ['cid'] : "";		$cid = $XDeode->decode ( $cid );		if (! is_numeric ( $cid ))			die ( 'illegal request' );				$year = $this->get_args ( 'year' ) ? $this->get_args ( 'year' ) : date ( "Y" );				Doo::loadModel ( 'invoiceStatistics' );		$invoiceStatistics = new invoiceStatistics ();		Doo::loadModel ( 'staff' );		$staff = new staff ();				$list = $staff->getStaffByCid ( $cid );		$isCategory = $invoiceStatistics->getInvoiceStatisticsByStaff ( $year, $cid );		$toteList = $invoiceStatistics->getInvoiceStatisticsByTote ( $year, $cid );				if (empty ( $list ))			die ( '该办事处没有成员' );		$htmlA = $htmlB = $htmlC = $html = '';		foreach ( $list as $key => $value ) {			$htmlA = '<tr><th rowspan="3">' . $value ['username'] . '</th><th class="taC">开票</th>';			$htmlB = '<tr><th class="taC">收款</th>';			$htmlC = '<tr><th class="taC">入账</th>';			$invoicePriceStaffYear = 0;			$receivablesPriceStaffYear = 0;			$accountPriceStaffYear = 0;			for($month = 1; $month <= 12; $month ++) {				$flag = true;				foreach ( $isCategory ['statisticsMonthStaff'] as $k => $v ) {					if ($value ['sid'] == $v ['staff'] && $month == $v ['month']) {						$htmlA .= '<td class="taR">¥' . $v ['invoicePrice'] . '</td>';						$htmlB .= '<td class="taR">¥' . $v ['receivablesPrice'] . '</td>';						$htmlC .= '<td class="taR"><b>¥' . $v ['accountPrice'] . '</b></td>';						$invoicePriceStaffYear += $v ['invoicePrice'];						$receivablesPriceStaffYear += $v ['receivablesPrice'];						$accountPriceStaffYear += $v ['accountPrice'];						$flag = false;						break;					}				}				if ($flag) {					$htmlA .= '<td class="taR">-</td>';					$htmlB .= '<td class="taR">-</td>';					$htmlC .= '<td class="taR"><b>-</b></td>';				}			}			$htmlA .= '<td class="taR colRed">' . $invoicePriceStaffYear . '</td>';			$htmlB .= '<td class="taR colOrange">' . $receivablesPriceStaffYear . '</td>';			$htmlC .= '<td class="taR colGreen"><b>' . $accountPriceStaffYear . '</b></td>';						$htmlA .= '</tr>';			$htmlB .= '</tr>';			$htmlC .= '</tr>';			$html .= $htmlA . $htmlB . $htmlC;		}				$htmlA = $htmlB = $htmlC = "";				$htmlA = '<tr><th rowspan="3">月合计</th><th class="taC">开票</th>';		$htmlB = '<tr><th class="taC">收款</th>';		$htmlC = '<tr><th class="taC">入账</th>';		$invoicePriceStaffYear = 0;		$receivablesPriceStaffYear = 0;		$accountPriceStaffYear = 0;		for($month = 1; $month <= 12; $month ++) {			$flag = true;			foreach ( $isCategory ['statisticsMonth'] as $k => $v ) {				if ($month == $v ['month']) {					$htmlA .= '<td class="taR colRed">¥' . $v ['invoicePrice'] . '</td>';					$htmlB .= '<td class="taR colOrange">¥' . $v ['receivablesPrice'] . '</td>';					$htmlC .= '<td class="taR colGreen"><b>¥' . $v ['accountPrice'] . '</b></td>';					$invoicePriceStaffYear += $v ['invoicePrice'];					$receivablesPriceStaffYear += $v ['receivablesPrice'];					$accountPriceStaffYear += $v ['accountPrice'];					$flag = false;					break;				}			}			if ($flag) {				$htmlA .= '<td class="taR">-</td>';				$htmlB .= '<td class="taR">-</td>';				$htmlC .= '<td class="taR"><b>-</b></td>';			}		}		$htmlA .= '<td class="taR colRed">' . $invoicePriceStaffYear . '</td>';		$htmlB .= '<td class="taR colOrange">' . $receivablesPriceStaffYear . '</td>';		$htmlC .= '<td class="taR colGreen"><b>' . $accountPriceStaffYear . '</b></td>';				$htmlA .= '</tr>';		$htmlB .= '</tr>';		$htmlC .= '</tr>';		$html .= $htmlA . $htmlB . $htmlC;				$this->data ['html'] = $html;				$this->data ['cidKey'] = $cidKey;		$this->data ['slist'] = $list;		$this->data ['isList'] = $toteList;		$this->data ['year'] = $year;		$this->data ['memu'] = "invoice";		$this->data ['staff'] = $this->staff;		$this->data ['receiptMemu'] = 'invoiceAggregate';		$this->render ( "/admin/invoiceAggregateCategory", $this->data );	}	function invoiceAchieve() {		Doo::loadModel ( 'invoice' );		$invoice = new invoice ();				$page_size=12;		$page = isset($this->params ['page'])&&is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;				$pageinfo['page']=array('previous'=>'');		//$pageinfo=$this->get_page("CLD_receipt", $dateCondition.$cateCondition.$staffCondition.' and verify in ('.$vid.') and status!=5', $page, $page_size, "approvalExpenses","","");				$invoice->getInvoiceByUntreadStatusPage();				$this->data ['memu'] = "invoice";		$this->data ['staff'] = $this->staff;		$this->data ['receiptMemu'] = 'invoice';		$this->render ( "/admin/invoiceAchieve", $this->data );	}		/**	 * 获得与我有关可收款的发票	 */	function ajaxGetInvoiceByStaff() {		$irid = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";		Doo::loadModel ( 'invoice' );		$invoice = new invoice ();				$list = $invoice->getInvoiceByReceivables ( $this->staff [0] ['sid'] );				$html = "";		$i = 1;		foreach ( $list as $key => $value ) {			$html .= '<tr>					<td>' . $value ['invoiceElement'] . '</td>					<td>¥' . $value ['invoicePrice'] . '</td>';			if (! empty ( $value ['invoiceType'] )) {				$html .= '<td>增值税专用发票</td>							<td>' . $value ['invoiceCompany'] . '</td>';			} else {				$html .= '<td>增值税普通发票</td>							<td>' . $value ['invoiceTitle'] . '</td>';			}						$html .= '<td><label><input type="radio" node-Claim="true_' . $i . '" p-data="' . $value ['iidKey'] . '" name="invoiceClaim"> 使用Ta</label></td></tr>					<script>					$(\'input[node-Claim="true_' . $i . '"]\').click(function() {											var invoiceKey=  $(this).attr("p-data");						var claimKey=$("input[name=\'key\']").val();						$("p[node-msg=\"true\"]").hide();						var url = "/ajaxCompareInvoicePrice";						$.ajax({							url : url,							type : "post",							cache : false,							dataType : "json",							data : {								claimKey : claimKey,								invoiceKey:invoiceKey							},							global : true,							success : function(data) {								$("input[name=\'invoiceKey\']").val("' . $value ['iidKey'] . '");								if (data.status == 1) {																		$("p[node-msg=\"true\"]").html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");									$("p[node-msg=\"true\"]").show();								}							},							error : function(err) {							}						});					});					</script>					';			$i ++;		}				echo json_encode ( array (				'status' => 1,				'html' => $html 		) );	}		/**	 * 获取一条收款信息	 */	function ajaxGetInvoiceReceivables() {		$irid = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";		Doo::loadModel ( 'invoiceReceivables' );		$invoiceReceivables = new invoiceReceivables ();				$detail = $invoiceReceivables->getInvoiceReceivablesByIrid ( $irid );				echo json_encode ( array (				'status' => 1,				'detail' => $detail 		) );	}		/**	 * 异步获取办事处用户	 */	function ajaxGetStaffByCategory() {		$cid = $this->get_args ( 'cid' ) ? $this->get_args ( 'cid' ) : "";		Doo::loadModel ( 'staff' );		$staff = new staff ();				if ($cid == "PUBLIC") {			echo json_encode ( array (					'status' => 1,					'html' => '<option value="PUBLIC">办事处待认领款项</option>' 			) );			die ();		}				if (! is_numeric ( $cid )) {			echo json_encode ( array (					'status' => 0,					'msg' => 'illegal request' 			) );			die ();		}				$staffList = $staff->getStaffByCid ( $cid );				$html = '<option value="PUBLIC">办事处待认领款项</option>';		foreach ( $staffList as $key => $value ) {			$html .= '<option value="' . $value ['sid'] . '-' . $value ['username'] . '">' . $value ['category'] . '-' . $value ['username'] . '</option>';		}				echo json_encode ( array (				'status' => 1,				'html' => $html 		) );	}		/**	 * 异步获取一条发票的邮寄信息	 */	function ajaxGetInvoicePostDetail() {		$iid = $this->get_args ( 'iidKey' ) ? $this->get_args ( 'iidKey' ) : "";		Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		$iid = $invoice->authcode ( $iid );				if (! is_numeric ( $iid )) {			echo json_encode ( array (					'status' => 0,					'msg' => 'illegal request' 			) );			die ();		}				$select = "iid,recipients,recipientsPhone,recipientsAddress,mailItems,expressCompany,expressNumber,actualItems";		$invoiceDetail = $invoice->getInvoiceByIid ( $iid, $select );		echo json_encode ( array (				'status' => 1,				'invoiceDetail' => $invoiceDetail 		) );	}	function ajaxCompareClaimPrice() {		$irid = $this->get_args ( 'irid' ) ? $this->get_args ( 'irid' ) : "";		$invoiceKey = $this->get_args ( 'invoiceKey' ) ? $this->get_args ( 'invoiceKey' ) : "";				Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadModel ( 'invoiceReceivables' );		$invoiceReceivables = new invoiceReceivables ();		Doo::loadModel ( 'invoiceOperationLog' );		$invoiceOperationLog = new invoiceOperationLog ();				$detail = $invoice->getInvoiceByIid ( $invoiceKey );		$detailM = $invoiceReceivables->getInvoiceReceivablesByIrid ( $irid );				if (empty ( $detail ) || empty ( $detailM )) {			echo json_encode ( array (					'status' => 2,					'msg' => '非法请求,请重新登录' 			) );			die ();		}				$iridString = "";		if (empty ( $detail ['irid'] ))			$iridString = $detailM ['irid'];		else			$iridString = $detail ['irid'] . ',' . $detailM ['irid'];				$item = array (				'irid' => $iridString,				'bindTime' => date ( "Y-m-d H:i:s" ),				'updateTime' => date ( "Y-m-d H:i:s" ),				'iid' => $detail ['iid'] 		);		$invoice->setInvoiceByCondition ( $item );				// 操作日志		$item = array (				'date' => date ( "Y-m-d H:i:s" ),				'operation' => "收款入账" . $detailM ['receivablesSerial'] . "到发票" . $detail ['invoiceSerial'],				'status' => 8,				'img' => $this->staff [0] ['avatar'],				'username' => $this->staff [0] ['username'],				'uid' => $this->staff [0] ['sid'],				'category' => $this->staff [0] ['category'],				'iid' => $detail ['iid'] 		);		$invoiceOperationLog->setInvoiceOperationLog ( $item );				$item = array (				'iid' => $detail ['iid'],				'irid' => $detailM ['irid'],				'bindDate' => date ( "Y-m-d H:i:s" ),				'bindStatus' => 1 		);		$invoiceReceivables->setInvoiceReceivablesByCondition ( $item );				$price = 0;		$priceStatus = 0;		$invoiceReceivables = new invoiceReceivables ();		$list = $invoiceReceivables->getInvoiceReceivablesInIridString ( $iridString );		$receivablesPrice = 0;				foreach ( $list as $key => $value ) {			$receivablesPrice += $value ['receivablesPrice'];		}		if ($receivablesPrice > $detail ['invoicePrice']) {			$price = $receivablesPrice - $detail ['invoicePrice'];			$priceStatus = 1;		}				echo json_encode ( array (				'status' => 1,				'html' => '<tr><td>¥' . $detailM ['receivablesPrice'] . '</td><td>' . $detailM ['receivablesMessage'] . '</td><td>' . $detailM ['receivablesBank'] . '</td>				<td>' . $detailM ['receivablesDate'] . '</td><td><a node-remove="Da' . $detailM ['iridKey'] . '" href="javascript:void(0);">移除</a></td></tr>				<script>					$(\'a[node-remove="Da' . $detailM ['iridKey'] . '"]\').click(function() {						var invoiceKey=$("input[name=\'key\']").val(); 						var irid=  $(this).attr("p-data");						var iridKey="' . $detailM ["iridEn"] . '";						var element=($(this));						$("p[node-loading=\"true\"]").show();						$("p[node-loading=\"true\"]").html("移除处理中...");													$("p[node-msg=\"true\"]").hide();						var url = "/ajaxReceivablesRemove";						$.ajax({							url : url,							type : "post",							cache : false,							dataType : "json",							data : {								key : iridKey,								invoiceKey:invoiceKey							},							global : true,							success : function(data) {								$("input[name=\'invoiceKey\']").val("' . $detailM ['iridEn'] . '");								if (data.status == 1) {									$(element).parent().parent().remove();									$("tbody[data-invoice=\"myReceivables\"]").append(data.html);									$("p[node-loading=\"true\"]").hide();									if(data.priceStatus == 1){										$("p[node-msg=\"true\"]").html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");										$("p[node-msg=\"true\"]").show();									}								}else if(data.status == 2){									$("p[node-loading=\"true\"]").html(data.msg);								}							},							error : function(err) {							}						});					});					</script>				',				'price' => $price,				'priceStatus' => $priceStatus 		) );	}		/**	 * 从发票中移除已经入账的收款	 */	function ajaxReceivablesRemove() {		$iridKey = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";		$invoiceKey = $this->get_args ( 'invoiceKey' ) ? $this->get_args ( 'invoiceKey' ) : "";				Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadModel ( 'invoiceReceivables' );		$invoiceReceivables = new invoiceReceivables ();		Doo::loadModel ( 'invoiceOperationLog' );		$invoiceOperationLog = new invoiceOperationLog ();				$detail = $invoice->getInvoiceByIid ( $invoiceKey );		$detailM = $invoiceReceivables->getInvoiceReceivablesByIrid ( $iridKey );		// echo $detail['irid']."<br/>";		$invoiceIrid = explode ( ",", $detail ['irid'] );		foreach ( $invoiceIrid as $key => $value ) {			if ($value == $detailM ['irid'])				unset ( $invoiceIrid [$key] );		}		$invoiceIrid = implode ( ",", $invoiceIrid );				// echo $invoiceIrid."ddd";		// print_r($invoiceIrid);				$item = array (				'irid' => $invoiceIrid,				'iid' => $detail ['iid'] 		);		$invoice->setInvoiceByCondition ( $item );				$item = array (				'iid' => 0,				'irid' => $detailM ['irid'],				'bindDate' => '',				'bindStatus' => 0 		);		$invoiceReceivables->setInvoiceReceivablesByCondition ( $item );				// 操作日志		$item = array (				'date' => date ( "Y-m-d H:i:s" ),				'operation' => "收款移除" . $detailM ['receivablesSerial'],				'status' => 10,				'img' => $this->staff [0] ['avatar'],				'username' => $this->staff [0] ['username'],				'uid' => $this->staff [0] ['sid'],				'category' => $this->staff [0] ['category'],				'iid' => $detail ['iid'] 		);		$invoiceOperationLog->setInvoiceOperationLog ( $item );				$price = 0;		$priceStatus = 0;		$list = $invoiceReceivables->getInvoiceReceivablesInIridString ( $invoiceIrid );		$receivablesPrice = 0;		foreach ( $list as $key => $value ) {			$receivablesPrice += $value ['receivablesPrice'];		}		if ($receivablesPrice >= $detail ['invoicePrice']) {			$price = $receivablesPrice - $detail ['invoicePrice'];			$priceStatus = 1;		}				echo json_encode ( array (				'status' => 1,				'html' => '<tr id="' . $detailM ['receivablesSerial'] . '" >					<td>¥' . $detailM ['receivablesPrice'] . '</td>					<td>' . $detailM ['receivablesMessage'] . '</td>					<td>' . $detailM ['receivablesBank'] . '</td>					<td>' . $detailM ['receivablesDate'] . '</td><td>					<a href="javascript:void(0)" node-Claim="true_' . $detailM ['iridKey'] . '" p-data="' . $detailM ['iridEn'] . '" name="invoiceClaim" class="button">入账</a>					</td></tr>					<script>					$(\'a[node-Claim="true_' . $detailM ['iridKey'] . '"]\').click(function() {						var invoiceKey=$("input[name=\'key\']").val(); 						var irid=  $(this).attr("p-data");						var element=($(this));						$("p[node-loading=\"true\"]").show();						$("p[node-loading=\"true\"]").html("入账处理中...");													$("p[node-msg=\"true\"]").hide();						var url = "/ajaxCompareClaimPrice";						$.ajax({							url : url,							type : "post",							cache : false,							dataType : "json",							data : {								irid : irid,								invoiceKey:invoiceKey							},							global : true,							success : function(data) {								$("input[name=\'invoiceKey\']").val("' . $detailM ['iridEn'] . '");								if (data.status == 1) {									$(element).parent().parent().remove();									$("tbody[box-enter=\"true\"]").append(data.html);									$("p[node-loading=\"true\"]").hide();									if(data.priceStatus == 1){										$("p[node-msg=\"true\"]").html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");										$("p[node-msg=\"true\"]").show();									}								}else if(data.status == 2){									$("p[node-loading=\"true\"]").html(data.msg);								}							},							error : function(err) {							}						});					});					</script>				',				'price' => $price,				'priceStatus' => $priceStatus 		) );	}		/**	 * 我的收款中 选择哪个发票入账,进行金额判断	 */	function ajaxCompareInvoicePrice() {		$claimKey = $this->get_args ( 'claimKey' ) ? $this->get_args ( 'claimKey' ) : "";		$invoiceKey = $this->get_args ( 'invoiceKey' ) ? $this->get_args ( 'invoiceKey' ) : "";				Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadModel ( 'invoiceReceivables' );		$invoiceReceivables = new invoiceReceivables ();				$detail = $invoice->getInvoiceByIid ( $invoiceKey );				$keyList = explode ( ';', $claimKey );		$receivablesPrice = 0;		foreach ( $keyList as $key => $value ) {			$detailM = $invoiceReceivables->getInvoiceReceivablesByIrid ( $value );			$receivablesPrice += $detailM ['receivablesPrice'];		}				if ($receivablesPrice >= $detail ['invoicePrice']) {			$price = $receivablesPrice - $detail ['invoicePrice'];			echo json_encode ( array (					'status' => 1,					'price' => $price 			) );		} else			echo json_encode ( array (					'status' => 2 			) );	}		/*	 * 获得与我有关收款数据	 */	function ajaxGetReceivalblesByStaff() {		$iid = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";		Doo::loadModel ( 'invoiceReceivables' );		$invoiceReceivables = new invoiceReceivables ();		Doo::loadModel ( 'invoice' );		$invoice = new invoice ();				$detail = $invoice->getInvoiceByIid ( $iid );		$list = $invoiceReceivables->getInvoiceReceivablesByClaim ( $this->staff [0] ['cid'], $this->staff [0] ['sid'] );				$html = "";		$i = 1;		foreach ( $list ['myClaim'] as $key => $value ) {			$html .= '<tr id="' . $value ['receivablesSerial'] . '" >					<td>¥' . $value ['receivablesPrice'] . '</td>					<td>' . $value ['receivablesMessage'] . '</td>					<td>' . $value ['receivablesBank'] . '</td>					<td>' . $value ['receivablesDate'] . '</td>';			$html .= '<td>					<a href="javascript:void(0)" node-Claim="true_' . $i . '" p-data="' . $value ['iidKey'] . '" name="invoiceClaim" class="button">入账</a>					</td></tr>					<script>					$(\'a[node-Claim="true_' . $i . '"]\').click(function() {						var invoiceKey=$("input[name=\'key\']").val(); 						var irid=  $(this).attr("p-data");						var element=($(this));						$("p[node-loading=\"true\"]").show();						$("p[node-loading=\"true\"]").html("入账处理中...");													$("p[node-msg=\"true\"]").hide();						var url = "/ajaxCompareClaimPrice";						$.ajax({							url : url,							type : "post",							cache : false,							dataType : "json",							data : {								irid : irid,								invoiceKey:invoiceKey							},							global : true,							success : function(data) {								$("input[name=\'invoiceKey\']").val("' . $value ['iidKey'] . '");								if (data.status == 1) {									$(element).parent().parent().remove();									$("tbody[box-enter=\"true\"]").append(data.html);									$("p[node-loading=\"true\"]").hide();									if(data.priceStatus == 1){										$("p[node-msg=\"true\"]").html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");										$("p[node-msg=\"true\"]").show();									}								}else if(data.status == 2){									$("p[node-loading=\"true\"]").html(data.msg);								}							},							error : function(err) {							}						});					});					</script>					';			$i ++;		}				$html2 = "";		$list2 = $invoiceReceivables->getInvoiceReceivablesByIid ( $iid, 1 );		foreach ( $list2 as $key => $value ) {			$html2 .= '<tr id="' . $value ['receivablesSerial'] . '" >					<td>¥' . $value ['receivablesPrice'] . '</td>					<td>' . $value ['receivablesMessage'] . '</td>					<td>' . $value ['receivablesBank'] . '</td>					<td>' . $value ['receivablesDate'] . '</td>';			$html2 .= '<td>					<a href="javascript:void(0)"  node-remove="Da' . $value ['iridKey'] . '" >移除</a>					</td></tr>					<script>					$(\'a[node-remove="Da' . $value ['iridKey'] . '"]\').click(function() {						var invoiceKey=$("input[name=\'key\']").val(); 						var irid=  $(this).attr("p-data");						var iridKey="' . $value ["iidKey"] . '";						var element=($(this));						$("p[node-loading=\"true\"]").show();						$("p[node-loading=\"true\"]").html("移除处理中...");													$("p[node-msg=\"true\"]").hide();						var url = "/ajaxReceivablesRemove";						$.ajax({							url : url,							type : "post",							cache : false,							dataType : "json",							data : {								key : iridKey,								invoiceKey:invoiceKey							},							global : true,							success : function(data) {								$("input[name=\'invoiceKey\']").val("' . $value ['iidKey'] . '");								if (data.status == 1) {									$(element).parent().parent().remove();									$("tbody[data-invoice=\"myReceivables\"]").append(data.html);									$("p[node-loading=\"true\"]").hide();									if(data.priceStatus == 1){										$("p[node-msg=\"true\"]").html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");										$("p[node-msg=\"true\"]").show();									}								}else if(data.status == 2){									$("p[node-loading=\"true\"]").html(data.msg);								}							},							error : function(err) {							}						});					});					</script>					';			$i ++;		}				$price = 0;		$priceStatus = 0;		$list = $invoiceReceivables->getInvoiceReceivablesInIridString ( $detail ['irid'] );		$receivablesPrice = 0;		foreach ( $list as $key => $value ) {			$receivablesPrice += $value ['receivablesPrice'];		}		if ($receivablesPrice >= $detail ['invoicePrice']) {			$price = $receivablesPrice - $detail ['invoicePrice'];			$priceStatus = 1;		}				echo json_encode ( array (				'status' => 1,				'html' => $html,				'html2' => $html2,				'price' => $price,				'priceStatus' => $priceStatus 		) );	}	function ajaxGetInvoiceInfoByType() {		$type = $this->get_args ( 'type' ) ? $this->get_args ( 'type' ) : "";		$serial = $this->get_args ( 'serial' ) ? $this->get_args ( 'serial' ) : "";				if (empty ( $serial )) {			echo json_encode ( array (					'status' => 2,					'msg' => 'illegal request' 			) );			die ();		}				if ($type == 'INVOICE') {			Doo::loadModel ( 'invoice' );			$invoice = new invoice ();						$detail = $invoice->getInvoiceByIsid ( $serial, $this->staff [0] ['sid'] );			if (empty ( $detail ))				$html = '';			else {				$html = '						<div class="modal-dialog modal-lg">				<div class="modal-content"><div class="modal-header"><h3>发票单详情</h3></div>				<div class="modal-body saeaList"><table class="table table-bordered table-condensed"><tbody>						<tr>							<th class="taC" width="150">开票流水号</th><td>' . $detail ['invoiceSerial'] . '</td>							<th class="taC" width="150">提交时间</th><td>' . $detail ['date'] . '</td>						</tr>						<tr>							<th class="taC" width="150">所在办事处</th><td>' . $detail ['categoryName'] . '(' . $detail ['userName'] . ')</td>							<th class="taC" width="150">备注</th><td>' . $detail ['remark'] . '</td>						</tr>						<tr>							<th class="taC">开票金额</th><td><b class="colOrange" style="font-size:18px">¥' . $detail ['invoicePrice'] . '</b></td>							<th class="taC">开票内容</th><td>' . $detail ['invoiceElement'] . '</td>						</tr></tbody></table>';								if ($detail ['invoiceType'] == 0)					$html .= '<table class="table table-bordered table-condensed"><tbody><tr><th colspan="4" class="taC">增值税普通发票</th></tr><tr>							<th class="taC" width="150">发票抬头</th><td colspan="3">' . $detail ['invoiceTitle'] . '</td></tr></tbody></table>';				else					$html .= '<table class="table table-bordered table-condensed"><tbody><tr><th colspan="4" class="taC">增值税专用发票</th></tr><tr>							<th class="taC" width="150">单位名称</th><td>' . $detail ['invoiceCompany'] . '</td>							<th class="taC" width="150">纳税人识别码</th><td>' . $detail ['TIN'] . '</td></tr><tr>							<th class="taC">注册地址</th><td>' . $detail ['address'] . '</td>							<th class="taC">注册电话</th><td>' . $detail ['phone'] . '</td>						</tr><tr>							<th class="taC">开户银行</th><td>' . $detail ['bankAccount'] . '</td>							<th class="taC">银行账户</th><td>' . $detail ['bank'] . '</td>						</tr></tbody></table>';				if ($detail ['doPost'] == 1)					$html .= '<table class="table table-bordered table-condensed"><tbody><tr><th colspan="4" class="taC">邮寄信息</th></tr><tr>							<th class="taC" width="150">收件人</th><td>' . $detail ['recipients'] . '</td>							<th class="taC" width="150">收件人手机/电话</th><td>' . $detail ['recipientsPhone'] . '</td>						</tr><tr>							<th class="taC" width="150">收件地址</th><td colspan="3">' . $detail ['recipientsAddress'] . '</td>						</tr><tr>							<th class="taC" width="150">邮寄物品</th><td colspan="3">' . $detail ['mailItems'] . '</td>						</tr></tbody></table>';								$html .= '</div><div class="modal-footer"><a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a></div></div></div>';			}			echo json_encode ( array (					'status' => 1,					'html' => $html 			) );			die ();		} elseif ($type == 'RECEIVABLES') {			Doo::loadModel ( 'invoiceReceivables' );			$invoiceReceivables = new invoiceReceivables ();						$detail = $invoiceReceivables->getInvoiceReceivablesByIrsid ( $serial, $this->staff [0] ['sid'] );			if (empty ( $detail ))				$html = '';			else {				$html = '<div class="modal-dialog modal-lg"><div class="modal-content"><div class="modal-header"><h3>收款单详情</h3></div><div class="modal-body saeaList"><table class="table table-bordered table-condensed">						<tbody><tr>							<th class="taC">收款流水号</th><td>' . $detail ['receivablesSerial'] . '</td>							<th class="taC">录入收款</th><td>' . $detail ['inputStaff'] . ' ' . $detail ['date'] . '</td>						</tr><tr>							<th class="taC">收款金额</th><td><b>¥' . $detail ['receivablesPrice'] . '</b></td>							<th class="taC">收款信息</th><td>' . $detail ['receivablesMessage'] . '</td>						</tr>						<tr>							<th class="taC">收款银行</th><td>' . $detail ['receivablesBank'] . '</td>							<th class="taC">银行到帐</th><td>' . $detail ['receivablesDate'] . '</td>						</tr>						<tr>							<th class="taC">认领收款</th><td colspan="3">' . $detail ['inputStaff'] . ' 转入 ' . $detail ['username'] . ' ' . $detail ['bindDate'] . '</td>						</tr>						</tbody></table></div><div class="modal-footer"><a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">关闭</a></div></div></div>';			}			echo json_encode ( array (					'status' => 1,					'html' => $html 			) );			die ();		}	}	function _GetFileEXT($filename) {		$pics = explode ( '.', $filename );		$num = count ( $pics );		return $pics [$num - 1];	}	function showCache($path = "") {		if (file_exists ( $path )) {			$htm = file_get_contents ( $path );		} else {			Doo::loadModel ( 'invoiceStatistics' );			$invoiceStatistics = new invoiceStatistics ();						$isBriefly = $invoiceStatistics->getBrieflyStatistics ();			$htm = '<tr><th class="taC">' . $isBriefly ['statisticsMonth'] [0] ['month'] . '月累计开票</th>				<td>¥' . $isBriefly ['statisticsMonth'] [0] ['invoicePrice'] . '</td>				<th class="taC">' . $isBriefly ['statisticsMonth'] [0] ['month'] . '月累计入账</th>				<td>¥' . $isBriefly ['statisticsMonth'] [0] ['accountPrice'] . '</td></tr>';			/*			 * '<tr><th class="taC">今年累计开票</th><td>¥' . $isBriefly ['statisticsYear'] [0] ['invoicePrice'] . '</td> <th class="taC">今年累计入账</th><td>¥' . $isBriefly ['statisticsYear'] [0] ['accountPrice'] . '</td></tr>';			 */			file_put_contents ( $path, $htm, FILE_APPEND );		}		return $htm;	}		/**	 * 获取get或者POST值	 *	 * @param string $name 属性名称	 * @return fixed 值	 */	function get_args($name) {		if (isset ( $_GET [$name] )) {			if (is_array ( $_GET [$name] ))				return $_GET [$name];			else				return addslashes ( $_GET [$name] );		} elseif (isset ( $_POST [$name] )) {			if (is_array ( $_POST [$name] ))				return $_POST [$name];			else				return addslashes ( $_POST [$name] );		} else			return false;	}	function isInvoiceNew($type = "GLOBAL") {		Doo::loadModel ( 'invoice' );		$invoice = new invoice ();		Doo::loadModel ( 'invoiceReceivables' );		$invoiceReceivables = new invoiceReceivables ();		Doo::loadModel ( 'staff' );		$staff = new staff ();				$st = $staff->getUserByIdList ( $_COOKIE ["staff"] );				// 我的发票待处理		$pendingInvoice = $invoice->getOne ( array (					'where' => "(status=3 or status=4 or (status=2 and printStatus=1 and untreadStatus=0 ) or (status=2 and printStatus=1 and untreadStatus=2 )  )  and isDelete=0 and sid=" . $_COOKIE ["staff"],					'desc' => 'iid',					'asArray' => TRUE 			) );		// 我的收款待入账		$myClaim = $invoiceReceivables->getOne ( array (				'where' => " receivablesStaff like '" . $_COOKIE ["staff"] . "-%' and receivablesCategory like '" . $st [0] ['cid'] . ":%' and bindStatus=0",				'desc' => 'irid',				'asArray' => TRUE 		) );		// 发票审批		$approval = $invoice->getOne ( array (				'where' => 'status=1 and pendingApprovals=' . $_COOKIE ["staff"],				'desc' => 'iid',				'asArray' => true 		) );		// 发票邮寄		$post = $invoice->getOne ( array (				'where' => "postStatus=0 and doPost=1 and status=2",				'asArray' => TRUE 		) );		// 发票打印		$print = $invoice->getOne ( array (				'where' => "status=2 and printStatus=0 and moldManage like '%[\"" . $_COOKIE ["staff"] . "\",%'",				'desc' => 'iid',				'asArray' => TRUE 		) );		// 发票退票		$untread = $invoice->getOne ( array (				'where' => " printStatus=1 and untreadStatus=1 and status=2 ",				'asArray' => TRUE 		) );				$new = array (				'GLOBAL' => FALSE,				'pendingInvoice' => FALSE,				'myClaim' => FALSE,				'approval' => FALSE,				'post' => FALSE,				'print' => FALSE,				'untread' => FALSE 		);				if (! empty ( $pendingInvoice ) || ! empty ( $myClaim ) || ! empty ( $approval ) || ! empty ( $post ) || ! empty ( $print ) || ! empty ( $untread ))			$new ['GLOBAL'] = TRUE;		if (! empty ( $pendingInvoice ))			$new ['pendingInvoice'] = TRUE;		if (! empty ( $myClaim ))			$new ['myClaim'] = TRUE;		if (! empty ( $approval ))			$new ['approval'] = TRUE;		if (! empty ( $post ))			$new ['post'] = TRUE;		if (! empty ( $print ))			$new ['print'] = TRUE;		if (! empty ( $untread ))			$new ['untread'] = TRUE;		return $new ;	}}?>
 |