receipt.finances.func.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <?php
  2. /**
  3. * 生成一个日常支出
  4. *
  5. * @param [type] $accountBook
  6. * @param [type] $expensesType
  7. * @param [type] $outlayAccountType
  8. * @param [type] $outlayAccountMsg
  9. * @param [type] $outlayPrice
  10. * @param [type] $outlayBank
  11. * @param [type] $outlayDate
  12. * @param [type] $outlayRemarks
  13. * @return void
  14. */
  15. function _saveOutlayAB($accountBook, $expensesType, $outlayAccountType, $operatingBankType, $depositMethod, $outlayMsg, $outlayPrice, $outlayBank, $outlayDate, $outlayRemarks, $staff) {
  16. $accountBook->expensesType = $expensesType;
  17. $accountBook->expenditureType = $outlayAccountType;
  18. $accountBook->operatingBankType = $operatingBankType;
  19. $accountBook->depositMethod = $depositMethod;
  20. $accountBook->expenditureMsg = $outlayMsg;
  21. $accountBook->expenditurePrice = $outlayPrice;
  22. $accountBook->expenditureBank = $outlayBank;
  23. $accountBook->expenditureDate = $outlayDate;
  24. $accountBook->remarks = $outlayRemarks;
  25. $accountBook->bookSerial = "#IN" . date ( "Ymd" ) . mt_rand ( 1000, 9999 );
  26. $accountBook->inputDate = date ( "Y-m-d H:i:s" );
  27. $accountBook->inputStaff = $staff [0] ['sid'];
  28. $id = $accountBook->insert ();
  29. return $id;
  30. }
  31. /**
  32. * 生成一条理财流水
  33. *
  34. * @return void
  35. */
  36. function _saveFWB($wasteBook, $expensesType, $accountType, $dailyType, $operatingBankType, $depositMethod, $outlayPrice, $outlayId, $accountBank, $outlayDate, $staff) {
  37. $itemWaste = array (
  38. 'expensesType' => $expensesType,
  39. 'accountType' => $accountType,
  40. 'dailyType' => $dailyType,
  41. 'operatingBankType' => $operatingBankType,
  42. 'depositMethod' => $depositMethod,
  43. 'accountPriceShow' => abs ( $outlayPrice ),
  44. 'accountPrice' => $outlayPrice,
  45. 'dataID' => $outlayId,
  46. 'accountBank' => $accountBank,
  47. 'category' => $staff [0] ['category'],
  48. 'cid' => $staff [0] ['cid'],
  49. 'name' => $staff [0] ['username'],
  50. 'sid' => $staff [0] ['sid'],
  51. 'inputDate' => $outlayDate,
  52. 'createAt' => date ( "Y-m-d H:i:s" ),
  53. 'synPaymentDate' => 1
  54. );
  55. $wasteBook->setAccountBookStatistics ( $itemWaste );
  56. }
  57. /**
  58. * 生成日常收入-理财
  59. *
  60. * @param [type] $accountBook
  61. * @param [type] $expensesType
  62. * @param [type] $accountType
  63. * @param [type] $operatingBankType
  64. * @param [type] $depositMethod
  65. * @param [type] $outlayBank
  66. * @param [type] $revenuePrice
  67. * @param [type] $revenueMsg
  68. * @param [type] $revenueDate
  69. * @param [type] $revenueRemarks
  70. * @param [type] $staff
  71. * @return void
  72. */
  73. function _saveRevenueAB($accountBook, $expensesType, $accountType, $operatingBankType, $depositMethod, $outlayBank, $revenuePrice, $revenueMsg, $revenueDate, $revenueRemarks, $staff) {
  74. $accountBook->expensesType = $expensesType;
  75. $accountBook->accountType = $accountType;
  76. $accountBook->operatingBankType = $operatingBankType;
  77. $accountBook->depositMethod = $depositMethod;
  78. $accountBook->receivedBank = $outlayBank;
  79. $accountBook->receivedPrice = $revenuePrice;
  80. $accountBook->receivedMsg = $revenueMsg;
  81. $accountBook->receivedDate = $revenueDate;
  82. $accountBook->remarks = $revenueRemarks;
  83. $accountBook->bookSerial = "#IN" . date ( "Ymd" ) . mt_rand ( 1000, 9999 );
  84. $accountBook->inputDate = date ( "Y-m-d H:i:s" );
  85. $accountBook->inputStaff = $staff [0] ['sid'];
  86. $inComeId = $accountBook->insert ();
  87. return $inComeId;
  88. }
  89. /**
  90. * 产生一条汇总信息
  91. *
  92. * @param [type] $abDetail
  93. * @param [type] $accountBookStatistics
  94. * @return void
  95. */
  96. function _saveAccountBookStatistics($abDetail, $accountBookStatistics) {
  97. $item = array (
  98. 'date' => date ( "Y-m-d" ),
  99. 'expenditureType' => $abDetail ['expenditureType'],
  100. 'expenditureMsg' => $abDetail ['expenditureMsg'],
  101. 'aid' => $abDetail ['aid'],
  102. 'payPrice' => $abDetail ['expenditurePrice'],
  103. 'expensesType' => $abDetail ['expensesType']
  104. );
  105. $accountBookStatistics->setAccountBookStatistics ( $item );
  106. }
  107. /**
  108. * 产生一条收入汇总信息
  109. *
  110. * @param [type] $abDetail
  111. * @param [type] $accountBookStatistics
  112. * @return void
  113. */
  114. function _saveRevenueAccountBookStatistics($abDetail, $accountBookStatistics) {
  115. $item = array (
  116. 'date' => date ( "Y-m-d" ),
  117. 'accountType' => $abDetail ['accountType'],
  118. 'accountMsg' => $abDetail ['accountMsg'],
  119. 'aid' => $abDetail ['aid'],
  120. 'inComePrice' => $abDetail ['receivedPrice'],
  121. 'expensesType' => $abDetail ['expensesType']
  122. );
  123. $accountBookStatistics->setAccountBookStatistics ( $item );
  124. }
  125. /**
  126. * 转换公司账号银行名称
  127. *
  128. * @param [type] $bank
  129. * @return void
  130. */
  131. function _getCompanyBankEN($bank) {
  132. $accountBank = '';
  133. if ($bank == '纵横广发' || $bank == '(纵横广发)广发存款') {
  134. $accountBank = 'CGBDeposit';
  135. } elseif ($bank == '纵横工行') {
  136. $accountBank = 'ICBCDeposit';
  137. } elseif ($bank == '个人存款') {
  138. $accountBank = 'PersonalDeposit';
  139. }
  140. return $accountBank;
  141. }
  142. /**
  143. * 理财银行转换名称的转换
  144. *
  145. * @param [type] $bank
  146. * @return void
  147. */
  148. function _getFinancesBankEN($bank) {
  149. $accountBank = '';
  150. if ($bank == '广发理财') {
  151. $accountBank = 'CGBDeposit';
  152. } elseif ($bank == '工行理财') {
  153. $accountBank = 'ICBCDeposit';
  154. } elseif ($bank == '个人理财(广发)') {
  155. $accountBank = 'CGBPersonalDeposit';
  156. }
  157. return $accountBank;
  158. }
  159. function _checkDepositMethod($revenueAccountMsg) {
  160. $depositMethod = '';
  161. if ($revenueAccountMsg == '固定') {
  162. $depositMethod = '固定';
  163. } elseif ($revenueAccountMsg == '活期') {
  164. $depositMethod = '活期';
  165. }
  166. return $depositMethod;
  167. }
  168. function _getRevenueTypeCN($value) {
  169. $revenueType = '';
  170. if ($value ['accountType'] == 6 || $value ['accountType'] == 9 || $value ['accountType'] == 10) {
  171. $revenueType = '日常收入-' . $value ['data'] ['incomeTypeMsg'];
  172. } elseif ($value ['accountType'] == 7 || $value ['accountType'] == 8) {
  173. $revenueType = '发票收款';
  174. } elseif ($value ['accountType'] == 1) {
  175. $revenueType = '费用收入(借款)';
  176. } elseif ($value ['accountType'] == 2) {
  177. $revenueType = '费用收入(借款报销)';
  178. } elseif ($value ['accountType'] == 3) {
  179. $revenueType = '费用收入(报销)';
  180. } elseif ($value ['accountType'] == 4) {
  181. $revenueType = '费用收入(对公汇款)';
  182. } elseif ($value ['accountType'] == 12) {
  183. $revenueType = '费用收入( 培训班结算)';
  184. }
  185. return $revenueType;
  186. }
  187. function _getOutlayTypeCN($value) {
  188. $outlayType = '';
  189. if ($value ['accountType'] == 5 || $value ['accountType'] == 9 || $value ['accountType'] == 10) {
  190. $outlayType = '日常支出-' . $value ['data'] ['expenditureTypeMsg'];
  191. } elseif ($value ['accountType'] == 1) {
  192. $outlayType = '费用管理(借款)';
  193. } elseif ($value ['accountType'] == 2) {
  194. $outlayType = '费用管理(借款报销)';
  195. } elseif ($value ['accountType'] == 3) {
  196. $outlayType = '费用管理(报销)';
  197. } elseif ($value ['accountType'] == 4) {
  198. $outlayType = '费用管理(对公汇款)';
  199. } elseif ($value ['accountType'] == 12) {
  200. $outlayType = '费用管理( 培训班结算)';
  201. } elseif ($value ['accountType'] == 11) {
  202. $outlayType = '收款退款';
  203. }
  204. return $outlayType;
  205. }
  206. function _structureReportItem($inputDate,$receivablesMessage,$revenueType,$category,$settlementType,$revenueBankMsg,$revenuePriceShow,$revenueTotalDay
  207. ,$outlayType,$outlayMsg,$outlayBankMsg,$outlayPriceShow,$outlayTotalDay){
  208. $item['inputDate']=$inputDate;
  209. $item['receivablesMessage']=$receivablesMessage;
  210. $item['revenueType']=$revenueType;
  211. $item['category']=$category;
  212. $item['settlementType']=$settlementType;
  213. $item['revenueBankMsg']=$revenueBankMsg;
  214. $item['revenuePriceShow']=$revenuePriceShow;
  215. $item['revenueTotalDay']=$revenueTotalDay;
  216. $item['outlayType']=$outlayType;
  217. $item['outlayMsg']=$outlayMsg;
  218. $item['outlayBankMsg']=$outlayBankMsg;
  219. $item['outlayPriceShow']=$outlayPriceShow;
  220. $item['outlayTotalDay']=$outlayTotalDay;
  221. $item['balance']=0;
  222. return $item;
  223. }
  224. ?>