TWarehousebillsfeesMapper.xml 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.warehouseBusiness.mapper.TWarehousebillsfeesMapper">
  6. <resultMap type="TWarehousebillsfees" id="TWarehousebillsfeesResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fPid" column="f_pid"/>
  9. <result property="fLineno" column="f_lineno"/>
  10. <result property="fCorpid" column="f_corpid"/>
  11. <result property="fShipper" column="f_shipper"/>
  12. <result property="fFeeid" column="f_feeid"/>
  13. <result property="fFeeunitid" column="f_feeUnitid"/>
  14. <result property="fWarehouseid" column="f_warehouseid"/>
  15. <result property="fQty" column="f_qty"/>
  16. <result property="fUnitprice" column="f_unitprice"/>
  17. <result property="fAmount" column="f_amount"/>
  18. <result property="fCurrency" column="f_currency"/>
  19. <result property="fExrate" column="f_exrate"/>
  20. <result property="fTaxrate" column="f_taxrate"/>
  21. <result property="fDc" column="f_dc"/>
  22. <result property="fBillstatus" column="f_billstatus"/>
  23. <result property="fReviewDate" column="f_review_date"/>
  24. <result property="fAccamount" column="f_accamount"/>
  25. <result property="fStatementNo" column="f_statement_no"/>
  26. <result property="fStlamount" column="f_stlamount"/>
  27. <result property="fInvnos" column="f_invnos"/>
  28. <result property="fAccamountDate" column="f_accamount_date"/>
  29. <result property="fInvamount" column="f_invamount"/>
  30. <result property="fStlamountNo" column="f_stlamount_no"/>
  31. <result property="fAskamount" column="f_askamount"/>
  32. <result property="fStatus" column="f_status"/>
  33. <result property="fStlamountDate" column="f_stlamount_date"/>
  34. <result property="delFlag" column="del_flag"/>
  35. <result property="createBy" column="create_by"/>
  36. <result property="createTime" column="create_time"/>
  37. <result property="updateBy" column="update_by"/>
  38. <result property="updateTime" column="update_time"/>
  39. <result property="remark" column="remark"/>
  40. <result property="srcId" column="src_id"/>
  41. <result property="srcBillNo" column="src_bill_no"/>
  42. <result property="fMblno" column="f_mblno"/>
  43. <result property="fProductName" column="f_product_name"/>
  44. <result property="fMarks" column="f_marks"/>
  45. <result property="fChargedate" column="f_chargedate"/>
  46. <result property="fBillingDeadline" column="f_billing_deadline"/>
  47. <result property="fInventoryDays" column="f_inventory_days"/>
  48. <result property="fAmt" column="f_amt"/>
  49. <result property="fBillingDays" column="f_billing_days"/>
  50. <result property="fBillingQty" column="f_billing_qty"/>
  51. <result property="fBilltype" column="f_billtype"/>
  52. <result property="fBillingway" column="f_billingway"/>
  53. <result property="fBsdate" column="f_bsdate"/>
  54. <result property="priceDateRemarks" column="price_date_remarks"/>
  55. <result property="fOriginalbilldate" column="f_originalbilldate"/>
  56. <result property="fStltypeid" column="f_stltypeid"/>
  57. <result property="fBusinessType" column="f_business_type"/>
  58. <result property="fSrcTypeId" column="f_src_type_id"/>
  59. </resultMap>
  60. <sql id="selectTWarehousebillsfeesVo">
  61. select f_id,
  62. f_pid,
  63. f_lineno,
  64. f_corpid,
  65. f_feeid,
  66. f_warehouseid,
  67. f_feeUnitid,
  68. f_qty,
  69. f_unitprice,
  70. f_amount,
  71. f_currency,
  72. f_exrate,
  73. f_taxrate,
  74. f_dc,
  75. f_billstatus,
  76. f_review_date,
  77. f_statement_no,
  78. f_accamount,
  79. f_stlamount,
  80. f_accamount_date,
  81. f_invnos,
  82. f_invamount,
  83. f_stlamount_no,
  84. f_askamount,
  85. f_status,
  86. f_stlamount_date,
  87. del_flag,
  88. create_by,
  89. create_time,
  90. update_by,
  91. update_time,
  92. remark,
  93. src_id,
  94. src_bill_no,
  95. f_mblno,
  96. f_product_name,
  97. f_marks,
  98. f_chargedate,
  99. f_billing_deadline,
  100. f_inventory_days,
  101. f_amt,
  102. f_billing_days,
  103. f_billing_qty,
  104. f_billtype,
  105. f_billingway,
  106. f_bsdate,
  107. f_originalbilldate,
  108. f_stltypeid,
  109. f_business_type,
  110. f_src_type_id,
  111. price_date_remarks
  112. from t_warehousebillsfees
  113. </sql>
  114. <select id="selectTWarehousebillsfeesList" parameterType="TWarehousebillsfees"
  115. resultMap="TWarehousebillsfeesResult">
  116. <include refid="selectTWarehousebillsfeesVo"/>
  117. <where>
  118. <if test="fPid != null ">and f_pid = #{fPid}</if>
  119. <if test="fLineno != null ">and f_lineno = #{fLineno}</if>
  120. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  121. <if test="fFeeid != null ">and f_feeid = #{fFeeid}</if>
  122. <if test="fFeeunitid != null ">and f_feeUnitid = #{fFeeunitid}</if>
  123. <if test="fQty != null ">and f_qty = #{fQty}</if>
  124. <if test="fUnitprice != null ">and f_unitprice = #{fUnitprice}</if>
  125. <if test="fAmount != null ">and f_amount = #{fAmount}</if>
  126. <if test="fCurrency != null and fCurrency != ''">and f_currency = #{fCurrency}</if>
  127. <if test="fExrate != null ">and f_exrate = #{fExrate}</if>
  128. <if test="fTaxrate != null ">and f_taxrate = #{fTaxrate}</if>
  129. <if test="fDc != null and fDc != ''">and f_dc = #{fDc}</if>
  130. <if test="fBillstatus != null and fBillstatus != ''">and f_billstatus = #{fBillstatus}</if>
  131. <if test="fReviewDate != null ">and f_review_date = #{fReviewDate}</if>
  132. <if test="fStatementNo != null and fStatementNo != ''">and f_statement_no = #{fStatementNo}</if>
  133. <if test="fAccamount != null ">and f_accamount = #{fAccamount}</if>
  134. <if test="fStlamount != null ">and f_stlamount = #{fStlamount}</if>
  135. <if test="fAccamountDate != null ">and f_accamount_date = #{fAccamountDate}</if>
  136. <if test="fInvnos != null and fInvnos != ''">and f_invnos = #{fInvnos}</if>
  137. <if test="fInvamount != null ">and f_invamount = #{fInvamount}</if>
  138. <if test="fStlamountNo != null and fStlamountNo != ''">and f_stlamount_no = #{fStlamountNo}</if>
  139. <if test="fAskamount != null ">and f_askamount = #{fAskamount}</if>
  140. <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
  141. <if test="fStlamountDate != null ">and f_stlamount_date = #{fStlamountDate}</if>
  142. <if test="srcId != null ">and src_id = #{srcId}</if>
  143. <if test="srcBillNo != null and srcBillNo != ''">and src_bill_no = #{srcBillNo}</if>
  144. <if test="fMblno != null and fMblno != ''">and f_mblno = #{fMblno}</if>
  145. <if test="fProductName != null and fProductName != ''">and f_product_name like concat('%', #{fProductName},
  146. '%')
  147. </if>
  148. <if test="fMarks != null and fMarks != ''">and f_marks = #{fMarks}</if>
  149. <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
  150. <if test="fBillingDeadline != null ">and f_billing_deadline = #{fBillingDeadline}</if>
  151. <if test="fInventoryDays != null ">and f_inventory_days = #{fInventoryDays}</if>
  152. <if test="fAmt != null ">and f_amt = #{fAmt}</if>
  153. <if test="fBillingDays != null ">and f_billing_days = #{fBillingDays}</if>
  154. <if test="fBillingQty != null ">and f_billing_qty = #{fBillingQty}</if>
  155. <if test="fBilltype != null and fBilltype != ''">and f_billtype = #{fBilltype}</if>
  156. <if test="fBillingway != null ">and f_billingway = #{fBillingway}</if>
  157. <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
  158. <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
  159. <if test="fStltypeid != null">and f_stltypeid = #{fStltypeid},</if>
  160. <if test="fSrcTypeId != null">and f_src_type_id = #{fSrcTypeId},</if>
  161. </where>
  162. </select>
  163. <select id="selectTWarehousebillsfeesById" parameterType="Long" resultMap="TWarehousebillsfeesResult">
  164. <include refid="selectTWarehousebillsfeesVo"/>
  165. where f_id = #{fId}
  166. </select>
  167. <select id="selectTWarehousebillsfeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
  168. select f_id, f_pid, f_billing_deadline, src_bill_no
  169. from t_warehousebillsfees
  170. where f_pid = #{fId}
  171. and f_billtype = 'SJCK'
  172. </select>
  173. <select id="selectWarehousebillsfeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
  174. <include refid="selectTWarehousebillsfeesVo"/>
  175. where f_pid = #{fId}
  176. </select>
  177. <select id="selectReconciliation" resultType="java.lang.Integer">
  178. SELECT COUNT(d.f_id)
  179. FROM t_fee_do d
  180. LEFT JOIN t_fee f ON d.f_pid = f.f_id
  181. WHERE d.f_srcpid = #{fId}
  182. AND f.f_billtype = 'DZ'
  183. </select>
  184. <select id="selectCharge" resultType="java.lang.Integer">
  185. SELECT COUNT(d.f_id)
  186. FROM t_fee_do d
  187. LEFT JOIN t_fee f ON d.f_pid = f.f_id
  188. WHERE d.f_srcpid = #{fId}
  189. AND f.f_billtype = 'SF'
  190. </select>
  191. <select id="selectPay" resultType="java.lang.Integer">
  192. SELECT COUNT(d.f_id)
  193. FROM t_fee_do d
  194. LEFT JOIN t_fee f ON d.f_pid = f.f_id
  195. WHERE d.f_srcpid = #{fId}
  196. AND f.f_billtype = 'FF'
  197. </select>
  198. <select id="selectFleetExcelMonthList" parameterType="TWarehousebillsfees" resultType="com.ruoyi.finance.excel.FleetExcel">
  199. SELECT
  200. CONCAT( MONTH ( s.f_bsdate ), '月份小计:' ) feelMonthName,
  201. CONCAT(
  202. YEAR ( s.f_bsdate ),
  203. '-',
  204. MONTH ( s.f_bsdate )) feelMonth,
  205. sum( CASE WHEN s.f_feeid = 27 THEN s.f_amount ELSE 0 END ) ccf,
  206. sum( CASE WHEN s.f_feeid != 27 THEN s.f_amount ELSE 0 END ) fAmount,
  207. sum( s.f_amount ) totalAmount,
  208. sum( s.f_invamount ) invamount,
  209. ROUND( sum( t.f_grossweightblc / 1000 ), 2 ) stock
  210. FROM
  211. t_warehousebillsfees s
  212. LEFT JOIN t_corps c ON s.f_corpid = c.f_id
  213. LEFT JOIN t_whgenleg t ON t.f_corpid = s.f_corpid
  214. WHERE
  215. s.f_dc = 'D'
  216. <if test='fMonth != null and fMonth[0] != null and fMonth[0]!= ""'>
  217. and s.f_bsdate &gt;= #{fMonth[0]}
  218. </if>
  219. <if test='fMonth != null and fMonth[1] != null and fMonth[1]!= ""'>
  220. and s.f_bsdate &lt;= #{fMonth[1]}
  221. </if>
  222. GROUP BY
  223. CONCAT(
  224. YEAR ( f_bsdate ),
  225. '-',
  226. MONTH ( f_bsdate ))
  227. </select>
  228. <select id="selectFleetExcelList" parameterType="TWarehousebillsfees" resultType="com.ruoyi.finance.excel.FleetExcel">
  229. SELECT
  230. #{createBy} userName,
  231. CONCAT(
  232. YEAR ( s.f_bsdate ),
  233. '-',
  234. MONTH ( s.f_bsdate )) feelMonth,
  235. c.f_name corpName,
  236. sum( CASE WHEN s.f_feeid = 27 THEN s.f_amount ELSE 0 END ) ccf,
  237. sum( CASE WHEN s.f_feeid != 27 THEN s.f_amount ELSE 0 END ) fAmount,
  238. sum( s.f_amount ) totalAmount,
  239. IF
  240. ( f_invamount = 0, 'F', 'T' ) isInvoice,
  241. sum( s.f_invamount ) invamount,
  242. ROUND( sum( t.f_grossweightblc / 1000 ), 2 ) stock
  243. FROM
  244. t_warehousebillsfees s
  245. LEFT JOIN t_corps c ON s.f_corpid = c.f_id
  246. LEFT JOIN t_whgenleg t ON t.f_corpid = s.f_corpid
  247. WHERE
  248. s.f_dc = 'D'
  249. <if test='fMonth != null and fMonth[0] != null and fMonth[0]!= ""'>
  250. and s.f_bsdate &gt;= #{fMonth[0]}
  251. </if>
  252. <if test='fMonth != null and fMonth[1] != null and fMonth[1]!= ""'>
  253. and s.f_bsdate &lt;= #{fMonth[1]}
  254. </if>
  255. GROUP BY CONCAT( YEAR ( f_bsdate ), '-', MONTH ( f_bsdate )), s.f_corpid, c.f_name
  256. </select>
  257. <insert id="insertTWarehousebillsfees" parameterType="TWarehousebillsfees" useGeneratedKeys="true"
  258. keyProperty="fId">
  259. insert into t_warehousebillsfees
  260. <trim prefix="(" suffix=")" suffixOverrides=",">
  261. <if test="fId != null">f_id,</if>
  262. <if test="fPid != null">f_pid,</if>
  263. <if test="fLineno != null">f_lineno,</if>
  264. <if test="fCorpid != null">f_corpid,</if>
  265. <if test="fFeeid != null">f_feeid,</if>
  266. <if test="fWarehouseid != null">f_warehouseid,</if>
  267. <if test="fFeeunitid != null">f_feeUnitid,</if>
  268. <if test="fQty != null">f_qty,</if>
  269. <if test="fUnitprice != null">f_unitprice,</if>
  270. <if test="fAmount != null">f_amount,</if>
  271. <if test="fCurrency != null">f_currency,</if>
  272. <if test="fExrate != null">f_exrate,</if>
  273. <if test="fTaxrate != null">f_taxrate,</if>
  274. <if test="fDc != null">f_dc,</if>
  275. <if test="fBillstatus != null">f_billstatus,</if>
  276. <if test="fReviewDate != null">f_review_date,</if>
  277. <if test="fStatementNo != null">f_statement_no,</if>
  278. <if test="fAccamount != null">f_accamount,</if>
  279. <if test="fStlamount != null">f_stlamount,</if>
  280. <if test="fAccamountDate != null">f_accamount_date,</if>
  281. <if test="fInvnos != null">f_invnos,</if>
  282. <if test="fInvamount != null">f_invamount,</if>
  283. <if test="fStlamountNo != null">f_stlamount_no,</if>
  284. <if test="fAskamount != null">f_askamount,</if>
  285. <if test="fStatus != null">f_status,</if>
  286. <if test="fStlamountDate != null">f_stlamount_date,</if>
  287. <if test="delFlag != null">del_flag,</if>
  288. <if test="createBy != null">create_by,</if>
  289. <if test="createTime != null">create_time,</if>
  290. <if test="updateBy != null">update_by,</if>
  291. <if test="updateTime != null">update_time,</if>
  292. <if test="remark != null">remark,</if>
  293. <if test="srcId != null">src_id,</if>
  294. <if test="srcBillNo != null">src_bill_no,</if>
  295. <if test="fMblno != null">f_mblno,</if>
  296. <if test="fProductName != null">f_product_name,</if>
  297. <if test="fMarks != null">f_marks,</if>
  298. <if test="fChargedate != null">f_chargedate,</if>
  299. <if test="fBillingDeadline != null">f_billing_deadline,</if>
  300. <if test="fInventoryDays != null">f_inventory_days,</if>
  301. <if test="fAmt != null">f_amt,</if>
  302. <if test="fBillingDays != null">f_billing_days,</if>
  303. <if test="fBillingQty != null">f_billing_qty,</if>
  304. <if test="fBilltype != null">f_billtype,</if>
  305. <if test="fBillingway != null">f_billingway,</if>
  306. <if test="fBsdate != null">f_bsdate,</if>
  307. <if test="fOriginalbilldate != null">f_originalbilldate,</if>
  308. <if test="fStltypeid != null">f_stltypeid,</if>
  309. <if test="fBusinessType != null">f_business_type,</if>
  310. <if test="fSrcTypeId != null">f_src_type_id,</if>
  311. <if test="priceDateRemarks != null">price_date_remarks,</if>
  312. </trim>
  313. <trim prefix="values (" suffix=")" suffixOverrides=",">
  314. <if test="fId != null">#{fId},</if>
  315. <if test="fPid != null">#{fPid},</if>
  316. <if test="fLineno != null">#{fLineno},</if>
  317. <if test="fCorpid != null">#{fCorpid},</if>
  318. <if test="fFeeid != null">#{fFeeid},</if>
  319. <if test="fWarehouseid != null">#{fWarehouseid},</if>
  320. <if test="fFeeunitid != null">#{fFeeunitid},</if>
  321. <if test="fQty != null">#{fQty},</if>
  322. <if test="fUnitprice != null">#{fUnitprice},</if>
  323. <if test="fAmount != null">#{fAmount},</if>
  324. <if test="fCurrency != null">#{fCurrency},</if>
  325. <if test="fExrate != null">#{fExrate},</if>
  326. <if test="fTaxrate != null">#{fTaxrate},</if>
  327. <if test="fDc != null">#{fDc},</if>
  328. <if test="fBillstatus != null">#{fBillstatus},</if>
  329. <if test="fReviewDate != null">#{fReviewDate},</if>
  330. <if test="fStatementNo != null">#{fStatementNo},</if>
  331. <if test="fAccamount != null">#{fAccamount},</if>
  332. <if test="fStlamount != null">#{fStlamount},</if>
  333. <if test="fAccamountDate != null">#{fAccamountDate},</if>
  334. <if test="fInvnos != null">#{fInvnos},</if>
  335. <if test="fInvamount != null">#{fInvamount},</if>
  336. <if test="fStlamountNo != null">#{fStlamountNo},</if>
  337. <if test="fAskamount != null">#{fAskamount},</if>
  338. <if test="fStatus != null">#{fStatus},</if>
  339. <if test="fStlamountDate != null">#{fStlamountDate},</if>
  340. <if test="delFlag != null">#{delFlag},</if>
  341. <if test="createBy != null">#{createBy},</if>
  342. <if test="createTime != null">#{createTime},</if>
  343. <if test="updateBy != null">#{updateBy},</if>
  344. <if test="updateTime != null">#{updateTime},</if>
  345. <if test="remark != null">#{remark},</if>
  346. <if test="srcId != null">#{srcId},</if>
  347. <if test="srcBillNo != null">#{srcBillNo},</if>
  348. <if test="fMblno != null">#{fMblno},</if>
  349. <if test="fProductName != null">#{fProductName},</if>
  350. <if test="fMarks != null">#{fMarks},</if>
  351. <if test="fChargedate != null">#{fChargedate},</if>
  352. <if test="fBillingDeadline != null">#{fBillingDeadline},</if>
  353. <if test="fInventoryDays != null">#{fInventoryDays},</if>
  354. <if test="fAmt != null">#{fAmt},</if>
  355. <if test="fBillingDays != null">#{fBillingDays},</if>
  356. <if test="fBillingQty != null">#{fBillingQty},</if>
  357. <if test="fBilltype != null">#{fBilltype},</if>
  358. <if test="fBillingway != null">#{fBillingway},</if>
  359. <if test="fBsdate != null">#{fBsdate},</if>
  360. <if test="fOriginalbilldate != null">#{fOriginalbilldate},</if>
  361. <if test="fStltypeid != null">#{fStltypeid},</if>
  362. <if test="fBusinessType != null">#{fBusinessType},</if>
  363. <if test="fSrcTypeId != null">#{fSrcTypeId},</if>
  364. <if test="priceDateRemarks != null">#{priceDateRemarks},</if>
  365. </trim>
  366. </insert>
  367. <update id="updateTWarehousebillsfees" parameterType="TWarehousebillsfees">
  368. update t_warehousebillsfees
  369. <trim prefix="SET" suffixOverrides=",">
  370. <if test="fPid != null">f_pid = #{fPid},</if>
  371. <if test="fLineno != null">f_lineno = #{fLineno},</if>
  372. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  373. <if test="fFeeid != null">f_feeid = #{fFeeid},</if>
  374. <if test="fFeeunitid != null">f_feeUnitid = #{fFeeunitid},</if>
  375. <if test="fQty != null">f_qty = #{fQty},</if>
  376. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  377. <if test="fUnitprice != null">f_unitprice = #{fUnitprice},</if>
  378. <if test="fAmount != null">f_amount = #{fAmount},</if>
  379. <if test="fCurrency != null">f_currency = #{fCurrency},</if>
  380. <if test="fExrate != null">f_exrate = #{fExrate},</if>
  381. <if test="fTaxrate != null">f_taxrate = #{fTaxrate},</if>
  382. <if test="fDc != null">f_dc = #{fDc},</if>
  383. <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
  384. <if test="fReviewDate != null">f_review_date = #{fReviewDate},</if>
  385. <if test="fStatementNo != null">f_statement_no = #{fStatementNo},</if>
  386. <if test="fAccamount != null">f_accamount = #{fAccamount},</if>
  387. <if test="fStlamount != null">f_stlamount = #{fStlamount},</if>
  388. <if test="fAccamountDate != null">f_accamount_date = #{fAccamountDate},</if>
  389. <if test="fInvnos != null">f_invnos = #{fInvnos},</if>
  390. <if test="fInvamount != null">f_invamount = #{fInvamount},</if>
  391. <if test="fStlamountNo != null">f_stlamount_no = #{fStlamountNo},</if>
  392. <if test="fAskamount != null">f_askamount = #{fAskamount},</if>
  393. <if test="fStatus != null">f_status = #{fStatus},</if>
  394. <if test="fStlamountDate != null">f_stlamount_date = #{fStlamountDate},</if>
  395. <if test="delFlag != null">del_flag = #{delFlag},</if>
  396. <if test="createBy != null">create_by = #{createBy},</if>
  397. <if test="createTime != null">create_time = #{createTime},</if>
  398. <if test="updateBy != null">update_by = #{updateBy},</if>
  399. <if test="updateTime != null">update_time = #{updateTime},</if>
  400. <if test="remark != null">remark = #{remark},</if>
  401. <if test="srcId != null">src_id = #{srcId},</if>
  402. <if test="srcBillNo != null">src_bill_no = #{srcBillNo},</if>
  403. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  404. <if test="fProductName != null">f_product_name = #{fProductName},</if>
  405. <if test="fMarks != null">f_marks = #{fMarks},</if>
  406. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  407. <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
  408. <if test="fInventoryDays != null">f_inventory_days = #{fInventoryDays},</if>
  409. <if test="fAmt != null">f_amt = #{fAmt},</if>
  410. <if test="fBillingDays != null">f_billing_days = #{fBillingDays},</if>
  411. <if test="fBillingQty != null">f_billing_qty = #{fBillingQty},</if>
  412. <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
  413. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  414. <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
  415. <if test="fOriginalbilldate != null">f_originalbilldate = #{fOriginalbilldate},</if>
  416. <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
  417. <if test="priceDateRemarks != null">price_date_remarks = #{priceDateRemarks},</if>
  418. <if test="fSrcTypeId != null">f_src_type_id = #{fSrcTypeId},</if>
  419. </trim>
  420. where f_id = #{fId}
  421. </update>
  422. <delete id="deleteTWarehousebillsfeesById" parameterType="Long">
  423. delete
  424. from t_warehousebillsfees
  425. where f_id = #{fId}
  426. </delete>
  427. <delete id="deleteByFPid" parameterType="Long">
  428. delete
  429. from t_warehousebillsfees
  430. where f_pid = #{fId}
  431. </delete>
  432. <delete id="deleteTWarehousebillsfeesByIds" parameterType="String">
  433. delete from t_warehousebillsfees where f_id in
  434. <foreach item="fId" collection="array" open="(" separator="," close=")">
  435. #{fId}
  436. </foreach>
  437. </delete>
  438. <update id="warehouseFeesFollowUpdate">
  439. update
  440. t_warehousebillsfees
  441. <trim prefix="SET" suffixOverrides=",">
  442. <if test="fettle != null">f_billstatus = #{fettle},</if>
  443. <if test="auditItem != null and fettle == 6">f_review_date = #{auditItem},</if>
  444. <if test="auditItem != null and fettle != 6">f_review_date = null,</if>
  445. </trim>
  446. where f_pid = #{fPid} and f_accamount &lt;= 0 and f_stlamount &lt;= 0 and f_invamount &lt;= 0
  447. </update>
  448. <update id="warehouseFeesFollowUpdateById">
  449. update
  450. t_warehousebillsfees
  451. <trim prefix="SET" suffixOverrides=",">
  452. <if test="fettle != null">f_billstatus = #{fettle},</if>
  453. <if test="auditItem != null and fettle == 6">f_review_date = #{auditItem},</if>
  454. <if test="auditItem != null and fettle != 6">f_review_date = null,</if>
  455. </trim>
  456. where f_id = #{fPid} and f_accamount &lt;= 0 and f_stlamount &lt;= 0 and f_invamount &lt;= 0
  457. </update>
  458. <update id="updateTWarehousebillsfee" parameterType="Map">
  459. update t_warehousebillsfees
  460. <trim prefix="SET" suffixOverrides=",">
  461. /*判断确认对账*/
  462. <if test="map.billType == 'DZ'">
  463. f_statement_no = #{map.tFee.fBillno},
  464. f_accamount = f_accamount + #{map.tFeeDo.fAmt},
  465. f_accamount_date = #{map.tFee.fAccbilldate}
  466. </if>
  467. /*判断撤销对账*/
  468. <if test="map.billType == 'DZRevoke'">
  469. f_statement_no = #{map.tFee.fBillno},
  470. f_accamount = f_accamount - #{map.tFeeDo.fAmt},
  471. f_accamount_date = #{map.tFee.fAccbilldate}
  472. </if>
  473. /*判断收付款*/
  474. <if test="map.billType == 'DC'">
  475. f_stlamount_no = #{map.tFee.fBillno},
  476. f_stlamount = f_stlamount + #{map.tFeeDo.fAmt},
  477. f_stlamount_date =#{map.tFee.fAccbilldate}
  478. </if>
  479. /*判断撤销收付款*/
  480. <if test="map.billType == 'DCRevoke'">
  481. f_stlamount_no = #{map.tFee.fBillno},
  482. f_stlamount = f_stlamount - #{map.tFeeDo.fAmt},
  483. f_stlamount_date =#{map.tFee.fAccbilldate}
  484. </if>
  485. /*判断开发票款*/
  486. <if test="map.billType == 'invoiceFP'">
  487. f_invamount = f_invamount + #{map.tFeeDo.fAmt},
  488. f_stlamount_date =#{map.tFee.fAccbilldate}
  489. </if>
  490. <if test="map.billType == 'DZinvoiceFP'">
  491. f_invamount = f_invamount - #{map.tFeeDo.fAmt},
  492. f_stlamount_date =#{map.tFee.fAccbilldate}
  493. </if>
  494. /*判断申请发票款*/
  495. <if test="map.billType == 'ApplyFP'">
  496. f_askamount = f_askamount + #{map.tFeeDo.fAmt},
  497. f_stlamount_date =#{map.tFee.fAccbilldate}
  498. </if>
  499. <if test="map.billType == 'DZApplyFP'">
  500. f_askamount = f_askamount - #{map.tFeeDo.fAmt},
  501. f_stlamount_date =#{map.tFee.fAccbilldate}
  502. </if>
  503. /*判断确认对账*/
  504. <if test="map.billType == 'KHDZ'">
  505. f_statement_no = #{map.tFee.fBillno},
  506. f_accamount = f_accamount + #{map.tFeeDo.fAmt},
  507. f_accamount_date = #{map.tFee.fAccbilldate}
  508. </if>
  509. /*判断撤销对账*/
  510. <if test="map.billType == 'KHDZRevoke'">
  511. f_statement_no = #{map.tFee.fBillno},
  512. f_accamount = f_accamount - #{map.tFeeDo.fAmt},
  513. f_accamount_date = #{map.tFee.fAccbilldate}
  514. </if>
  515. /*判断确认仓库发票*/
  516. <if test="map.billType == 'FP'">
  517. f_invnos = #{map.tFee.fBillno},
  518. f_invamount = f_invamount + #{map.tFeeDo.fAmt}
  519. </if>
  520. /*判断撤销仓库发票*/
  521. <if test="map.billType == 'FPRevoke'">
  522. f_invnos = #{map.tFee.fBillno},
  523. f_invamount = f_invamount - #{map.tFeeDo.fAmt}
  524. </if>
  525. </trim>
  526. where f_id = #{map.tFeeDo.fSrcid}
  527. </update>
  528. <select id="selectFeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
  529. SELECT
  530. tw.f_id,
  531. tw.f_pid,
  532. tw.f_lineno,
  533. tw.f_corpid,
  534. tc.f_name corpName,
  535. tw.f_feeid,
  536. tf.f_name feeName,
  537. tw.f_feeUnitid,
  538. tw.f_qty,
  539. tw.f_unitprice,
  540. tw.f_amount,
  541. tw.f_currency,
  542. tw.f_exrate,
  543. tw.f_taxrate,
  544. tw.f_dc,
  545. tw.f_billstatus,
  546. CASE
  547. WHEN tw.f_billstatus = '1' THEN
  548. '新建'
  549. WHEN tw.f_billstatus = '2' THEN
  550. '暂存'
  551. WHEN tw.f_billstatus = '3' THEN
  552. '驳回'
  553. WHEN tw.f_billstatus = '4' THEN
  554. '提交'
  555. WHEN tw.f_billstatus = '5' THEN
  556. '审批中'
  557. WHEN tw.f_billstatus = '6' THEN
  558. '审批通过'
  559. END AS fBillstatusName,
  560. tw.f_review_date,
  561. tw.f_statement_no,
  562. tw.f_accamount,
  563. tw.f_stlamount,
  564. tw.f_accamount_date,
  565. tw.f_invnos,
  566. tw.f_invamount,
  567. tw.f_stlamount_no,
  568. tw.f_askamount,
  569. tw.f_status,
  570. tw.f_stlamount_date,
  571. tw.del_flag,
  572. tw.create_by,
  573. tw.create_time,
  574. tw.update_by,
  575. tw.update_time,
  576. tw.remark,
  577. tw.src_id,
  578. tw.src_bill_no,
  579. tw.f_mblno,
  580. tw.f_product_name,
  581. tw.f_marks,
  582. tw.price_date_remarks,
  583. tw.f_chargedate,
  584. tw.f_billing_deadline,
  585. tw.f_inventory_days,
  586. tw.f_amt,
  587. tw.f_billing_days,
  588. tw.f_billing_qty,
  589. tw.f_billtype,
  590. tw.f_billingway,
  591. tw.f_bsdate,
  592. tw.f_originalbilldate,
  593. tw.f_stltypeid,
  594. tw.f_business_type,
  595. tw.f_src_type_id
  596. FROM
  597. t_warehousebillsfees tw
  598. LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
  599. LEFT JOIN t_corps tc ON tw.f_corpid = tc.f_id
  600. where tw.f_pid = #{fPid}
  601. and tw.f_billtype = 'KHDD'
  602. <if test="fDc != null and fDc != ''">and tw.f_dc = #{fDc}</if>
  603. </select>
  604. <select id="voyageFeeDetails" resultType="map">
  605. SELECT
  606. tf.f_name feeName,
  607. SUM(tw.f_unitprice) fUnitprice,
  608. SUM(tw.f_amount) fAmount
  609. FROM
  610. t_warehousebillsfees tw
  611. LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
  612. WHERE
  613. tw.f_pid = #{fPid}
  614. AND tw.f_billtype = 'KHDD'
  615. <if test="fDc != null and fDc != ''">AND tw.f_dc = #{fDc}</if>
  616. GROUP BY feeName;
  617. </select>
  618. <delete id="deleteFessByFPid" parameterType="object">
  619. delete
  620. from t_warehousebillsfees
  621. where f_pid = #{fPid}
  622. <if test="fDc != null and fDc != ''">and f_dc = #{fDc}</if>
  623. </delete>
  624. <!--网页版查询对账-->
  625. <select id="webVersionReconciliation" parameterType="TAccount" resultType="map">
  626. SELECT
  627. tb.f_billno AS fBillno,
  628. /**运单号*/
  629. tv.f_name AS vesselName,
  630. /**船名*/
  631. ty.f_no AS voyageName,
  632. /**航次*/
  633. tc.f_name AS invoice,
  634. /**收费单位*/
  635. tc.f_name AS drawee,
  636. /**受票单位*/
  637. tp.f_name AS corpName,
  638. /**货权方*/
  639. pro.dict_label AS fPaymode,
  640. /**付款方式*/
  641. te.f_name AS payment,
  642. /**费用名称*/
  643. ifnull( tf.f_amount, 0 ) - ifnull( tf.f_accamount, 0 ) AS fAmtdr,
  644. /**原始金额*/
  645. ifnull( tf.f_amount, 0 ) - ifnull( tf.f_accamount, 0 ) AS fAmt,
  646. /**本次金额*/
  647. ta.f_name AS fLoadportidName,
  648. /**始发港*/
  649. tr.f_name AS fDestportidName,
  650. /**目的港*/
  651. pr.dict_label AS fServiceitems,
  652. /**运输条款*/
  653. tg.f_name AS goodName,
  654. /**货名*/
  655. tn.f_name AS transit,
  656. /**箱型*/
  657. items.f_cntrcount AS fCntrcount,
  658. /**箱量*/
  659. tb.f_shippername AS fShippername,
  660. /**发货人*/
  661. tb.f_consigneername AS fConsigneername,
  662. /**收货人*/
  663. tf.f_id AS fSrcid,
  664. tf.f_pid AS fSrcpid,
  665. tf.create_by AS createBy,
  666. tf.create_time AS createTime,
  667. tf.update_by AS updateBy,
  668. tf.update_time AS updateTime,
  669. tf.remark AS remark,
  670. tf.f_mblno AS fMblno,
  671. tf.f_corpid AS fCorpid,
  672. tf.f_feeid AS fFeeid
  673. FROM
  674. t_warehousebillsfees tf
  675. LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
  676. LEFT JOIN t_fees te ON te.f_id = tf.f_feeid
  677. LEFT JOIN t_warehousebills tb ON tb.f_id = tf.f_pid
  678. LEFT JOIN t_vessel tv ON tv.f_id = tb.f_vslid
  679. LEFT JOIN t_voyage ty ON ty.f_id = tb.f_voyid
  680. LEFT JOIN t_address ta ON ta.f_id = tb.f_loadportid
  681. LEFT JOIN t_address tr ON tr.f_id = tb.f_destportid
  682. LEFT JOIN sys_dict_data pro ON pro.dict_value = tb.f_paymode
  683. AND pro.dict_type = 'data_settlement_type'
  684. LEFT JOIN sys_dict_data pr ON pr.dict_value = tb.f_serviceitems
  685. AND pr.dict_type = 'f_serviceitems'
  686. LEFT JOIN ( SELECT f_pid, MAX( f_goodsid ) f_goodsid FROM t_warehousebills_cntr GROUP BY f_pid ) w ON w.f_pid = tb.f_id
  687. LEFT JOIN t_goods tg ON tg.f_id = w.f_goodsid
  688. LEFT JOIN ( SELECT f_pid, SUM( f_cntrcount ) f_cntrcount FROM t_warehousebills_cntritems GROUP BY f_pid ) items ON items.f_pid = tb.f_id
  689. LEFT JOIN ( SELECT f_pid, MAX( f_cntrid ) f_cntrid FROM t_warehousebills_cntritems GROUP BY f_pid ) twc ON twc.f_pid = tb.f_id
  690. LEFT JOIN t_cntr tn ON tn.f_id = twc.f_cntrid
  691. LEFT JOIN t_corps tp ON tp.f_id = tb.f_corpid
  692. WHERE
  693. tf.f_billstatus = 6
  694. AND tf.f_dc = 'D'
  695. AND tb.f_typeid = 1
  696. and tb.f_review_date IS NOT NULL
  697. and ifnull(tf.f_amount, 0) - ifnull(tf.f_accamount, 0) > 0
  698. <if test="fLoadportid != null">and tb.f_loadportid = #{fLoadportid}</if>
  699. <if test="fDestportid != null">and tb.f_destportid = #{fDestportid}</if>
  700. <if test="fInvoceobj != null and fInvoceobj != ''">and tb.f_invoceobj like concat('%', #{fInvoceobj}, '%') </if>
  701. <if test="fShippername != null and fShippername != ''">and tb.f_shippername like concat('%', #{fShippername}, '%') </if>
  702. <if test="fConsigneername != null and fConsigneername != ''">and tb.f_consigneername like concat('%', #{fConsigneername}, '%') </if>
  703. <if test="fMblno != null and fMblno != ''">and tb.f_mblno like concat('%', #{fMblno}, '%') </if>
  704. <if test="fBillno != null and fBillno != ''">and tb.f_billno like concat('%', #{fBillno}, '%') </if>
  705. <if test="fVslid != null">and tb.f_vslid = #{fVslid}</if>
  706. <if test="fVoyid != null">and tb.f_voyid = #{fVoyid}</if>
  707. <if test="fCorpid != null">and tf.f_corpid = #{fCorpid}</if>
  708. <if test="fPaymodeid != null">and tb.f_paymode = #{fPaymodeid}</if>
  709. <if test='sailTime != null and sailTime[0] != null and sailTime[0]!= ""'>
  710. and tf.create_time &gt;= #{sailTime[0]}
  711. </if>
  712. <if test='sailTime != null and sailTime[1] != null and sailTime[1]!= ""'>
  713. and tf.create_time &lt;= #{sailTime[1]}
  714. </if>
  715. <if test="fDocmentdate != null and fDocmentdate != ''">and tb.f_docmentdate = #{fDocmentdate}</if>
  716. <if test="createBy != null and createBy != ''">and tb.create_by = #{createBy}</if>
  717. <if test="goodName != null and goodName != ''">and tg.f_name like concat('%', #{goodName}, '%')</if>
  718. ORDER BY tf.f_id desc
  719. </select>
  720. <!--网页版查询对账明细-->
  721. <select id="webVersionDetail" parameterType="TAccount" resultType="map">
  722. SELECT
  723. tf.f_id AS fId,
  724. te.f_billno AS accountBillno,
  725. /**账单编号*/
  726. tw.f_billno AS fBillno,
  727. /**运单编号*/
  728. tv.f_name AS vesselName,
  729. /**船名*/
  730. ty.f_no AS voyageName,
  731. /**航次*/
  732. te.f_ctrlcorpid AS fCtrlcorpid,
  733. /**获权方*/
  734. tp.f_name AS corpName,
  735. /**结算单位*/
  736. ta.f_name AS fLoadportidName,
  737. /**始发港*/
  738. tr.f_name AS fDestportidName,
  739. /**目的港*/
  740. pr.dict_label AS fServiceitems,
  741. /**运输条款*/
  742. ts.f_name AS payment,
  743. /**费用名称*/
  744. tf.f_amtdr AS fAmtdr,
  745. /**原始金额*/
  746. tf.f_amt AS fAmt,
  747. /**本次金额*/
  748. tn.f_name AS transit,
  749. /**箱型*/
  750. items.f_cntrcount AS fCntrcount,
  751. /**箱量*/
  752. tf.create_by AS createBy,
  753. tf.create_time AS createTime,
  754. CASE
  755. WHEN te.f_billstatus = '1' THEN
  756. '保存'
  757. WHEN te.f_billstatus = '2' THEN
  758. '暂存'
  759. WHEN te.f_billstatus = '3' THEN
  760. '审批驳回'
  761. WHEN te.f_billstatus = '4' THEN
  762. '提交审核'
  763. WHEN te.f_billstatus = '5' THEN
  764. '审核中'
  765. WHEN te.f_billstatus = '6' THEN
  766. '审核完成'
  767. END AS fBillstatus
  768. FROM
  769. t_fee_do tf
  770. LEFT JOIN t_fee te ON te.f_id = tf.f_pid
  771. LEFT JOIN t_warehousebills tw ON tf.f_srcpid = tw.f_id
  772. LEFT JOIN t_warehousebillsfees th ON th.f_id = tf.f_srcid
  773. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  774. LEFT JOIN t_voyage ty ON ty.f_id = tw.f_voyid
  775. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  776. LEFT JOIN t_address tr ON tr.f_id = tw.f_destportid
  777. LEFT JOIN sys_dict_data pr ON pr.dict_value = tw.f_serviceitems
  778. AND pr.dict_type = 'f_serviceitems'
  779. LEFT JOIN t_fees ts ON ts.f_id = tf.f_feeid
  780. LEFT JOIN ( SELECT f_pid, SUM( f_cntrcount ) f_cntrcount FROM t_warehousebills_cntritems GROUP BY f_pid ) items ON items.f_pid = tw.f_id
  781. LEFT JOIN ( SELECT f_pid, MAX( f_cntrid ) f_cntrid FROM t_warehousebills_cntritems GROUP BY f_pid ) twc ON twc.f_pid = tw.f_id
  782. LEFT JOIN t_cntr tn ON tn.f_id = twc.f_cntrid
  783. LEFT JOIN t_corps tp ON tp.f_id = te.f_corpid
  784. WHERE
  785. te.f_billtype = 'KHDZ'
  786. <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
  787. <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
  788. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj like concat('%', #{fInvoceobj}, '%') </if>
  789. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%', #{fShippername}, '%') </if>
  790. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%', #{fConsigneername}, '%') </if>
  791. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  792. <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
  793. <if test="fId != null">and tf.f_id = #{fId}</if>
  794. <if test="fVoyid != null">and tw.f_voyid = #{fVoyid}</if>
  795. <if test="fCorpid != null">and te.f_corpid = #{fCorpid}</if>
  796. <if test="fPaymodeid != null">and tw.f_paymode = #{fPaymodeid}</if>
  797. <if test='sailTime != null and sailTime[0] != null and sailTime[0]!= ""'>
  798. and tf.create_time &gt;= #{sailTime[0]}
  799. </if>
  800. <if test='sailTime != null and sailTime[1] != null and sailTime[1]!= ""'>
  801. and tf.create_time &lt;= #{sailTime[1]}
  802. </if>
  803. <if test="fDocmentdate != null and fDocmentdate != ''">and tw.f_docmentdate = #{fDocmentdate}</if>
  804. <if test="createBy != null and createBy != ''">and te.create_by = #{createBy}</if>
  805. <if test="accountBillno != null and accountBillno != ''">and te.f_billno = #{accountBillno}</if>
  806. ORDER BY tf.f_id desc
  807. </select>
  808. <select id="selectTWarehousebillsfeesSrcId" parameterType="Long" resultType="long">
  809. select src_id
  810. FROM
  811. t_warehousebillsfees
  812. where f_pid = #{fId}
  813. AND src_id IS NOT NULL
  814. </select>
  815. <select id="accountsDue" resultType="map">
  816. SELECT
  817. CASE MONTH(tf.create_time) WHEN '1' THEN SUM(tf.f_amount) ELSE 0 END AS January,
  818. CASE MONTH(tf.create_time) WHEN '2' THEN SUM(tf.f_amount) ELSE 0 END AS February,
  819. CASE MONTH(tf.create_time) WHEN '3' THEN SUM(tf.f_amount) ELSE 0 END AS March,
  820. CASE MONTH(tf.create_time) WHEN '4' THEN SUM(tf.f_amount) ELSE 0 END AS April,
  821. CASE MONTH(tf.create_time) WHEN '5' THEN SUM(tf.f_amount) ELSE 0 END AS May,
  822. CASE MONTH(tf.create_time) WHEN '6' THEN SUM(tf.f_amount) ELSE 0 END AS June,
  823. CASE MONTH(tf.create_time) WHEN '7' THEN SUM(tf.f_amount) ELSE 0 END AS July,
  824. CASE MONTH(tf.create_time) WHEN '8' THEN SUM(tf.f_amount) ELSE 0 END AS August,
  825. CASE MONTH(tf.create_time) WHEN '9' THEN SUM(tf.f_amount) ELSE 0 END AS September,
  826. CASE MONTH(tf.create_time) WHEN '10' THEN SUM(tf.f_amount) ELSE 0 END AS October,
  827. CASE MONTH(tf.create_time) WHEN '11' THEN SUM(tf.f_amount) ELSE 0 END AS November,
  828. CASE MONTH(tf.create_time) WHEN '12' THEN SUM(tf.f_amount) ELSE 0 END AS December,
  829. tc.f_name corpName
  830. FROM
  831. t_warehousebillsfees tf
  832. LEFT JOIN t_corps tc ON tf.f_corpid = tc.f_id
  833. WHERE ifnull(tf.f_amount, 0) - ifnull(tf.f_stlamount, 0) >0
  834. AND tf.f_dc = 'D'
  835. AND YEAR(tf.create_time) = YEAR(NOW())
  836. GROUP BY tf.f_corpid
  837. LIMIT 10
  838. </select>
  839. <select id="selectQueryMenuList" parameterType="TWarehousebillsfees" resultType="com.ruoyi.warehouseBusiness.excel.QueryMenu">
  840. SELECT
  841. tc.f_name AS corpName,
  842. tf.f_mblno AS fMblno,
  843. tf.f_bsdate AS fBsdate,
  844. tf.f_review_date AS fReviewDate,
  845. te.f_name AS feeName,
  846. tf.f_dc AS fDc,
  847. tf.f_amount AS fAmount,
  848. tf.f_stlamount_no AS fStlamountNo,
  849. tw.f_shipper AS fShipper,
  850. tf.f_stlamount AS fStlamount,
  851. tf.f_stlamount_date AS fStlamountDate,
  852. tf.f_invamount AS fInvamount,
  853. tf.f_invnos AS fInvnos,
  854. tf.f_accamount AS fAccamount,
  855. tf.f_accamount_date AS fAccamountDate,
  856. tf.f_statement_no AS fStatementNo,
  857. tf.f_feeUnitid AS fFeeUnitid,
  858. tf.f_qty AS fQty,
  859. tf.f_unitprice AS fUnitprice,
  860. tf.f_billtype AS fBilltype,
  861. tf.f_product_name AS fProductName,
  862. tf.f_stltypeid AS fStltypeid,
  863. tf.remark AS remark,
  864. CASE
  865. WHEN tf.f_billstatus = '1' THEN '录入'
  866. WHEN tf.f_billstatus = '2' THEN '暂存'
  867. WHEN tf.f_billstatus = '3' THEN '审批驳回'
  868. WHEN tf.f_billstatus = '4' THEN '提交审核'
  869. WHEN tf.f_billstatus = '5' THEN '审核中'
  870. WHEN tf.f_billstatus = '6' THEN '审核通过'
  871. END AS fBillstatusName
  872. FROM t_warehousebillsfees tf
  873. LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
  874. LEFT JOIN t_fees te ON te.f_id = tf.f_feeid
  875. LEFT JOIN t_warehousebills tw on tf.f_pid = tw.f_id
  876. <where>
  877. <if test="fBillstatus != null and fBillstatus != ''">and tf.f_billstatus = #{fBillstatus}</if>
  878. <if test="fDc != null and fDc != ''">and tf.f_dc = #{fDc}</if>
  879. <if test="fMblno != null and fMblno != ''">and tf.f_mblno like concat('%', #{fMblno}, '%')</if>
  880. <if test="fStalmountStatus == 1">and tf.f_stlamount_no is not null and tf.f_stlamount!=0</if>
  881. <if test="fStalmountStatus == 2">and tf.f_stlamount_no is null</if>
  882. <if test="feesStatus == 1">and tf.f_statement_no is not null and tf.f_accamount &gt;= 0 and tf.f_accamount != 0</if>
  883. <if test="feesStatus == 2">and tf.f_statement_no is null</if>
  884. <if test="fInvnosStatus == 1">and tf.f_invnos is not null and tf.f_invamount != 0</if>
  885. <if test="fInvnosStatus == 2">and tf.f_invnos is null</if>
  886. <if test="fCorpid != null and fCorpid != ''">and tf.f_corpid = #{fCorpid}</if>
  887. <if test="fShipper != null and fShipper != ''">and tw.f_shipper like concat('%',#{fShipper},'%')</if>
  888. <if test="fStltypeid != null">and tf.f_stltypeid = #{fStltypeid}</if>
  889. <if test='fFeeids != null'>
  890. and tf.f_feeid in
  891. <foreach item="fFeeid" collection="fFeeids" open="(" separator="," close=")">
  892. #{fFeeid}
  893. </foreach>
  894. </if>
  895. <if test='fReviewDateList != null and fReviewDateList[0] != null and fReviewDateList[0]!= ""'>
  896. and tf.f_review_date &gt;= #{fReviewDateList[0]}
  897. </if>
  898. <if test='fReviewDateList != null and fReviewDateList[1] != null and fReviewDateList[1]!= ""'>
  899. and tf.f_review_date &lt;= #{fReviewDateList[1]}
  900. </if>
  901. <if test='fBsdateList != null and fBsdateList[0] != null and fBsdateList[0]!= ""'>
  902. and tf.f_bsdate &gt;= #{fBsdateList[0]}
  903. </if>
  904. <if test='fBsdateList != null and fBsdateList[1] != null and fBsdateList[1]!= ""'>
  905. and tf.f_bsdate &lt;= #{fBsdateList[1]}
  906. </if>
  907. </where>
  908. ORDER BY tf.f_bsdate desc
  909. </select>
  910. <select id="selectBillDetailsSubItem" resultType="com.ruoyi.warehouseBusiness.excel.BillDetailsSubItem">
  911. select
  912. tw.f_business_type as fBusinesstype,
  913. twl.f_business_type as twlfBusinesstype,
  914. tw.f_corpid as fCorpid,
  915. tw.f_statement_no as fStatementno,
  916. tg.f_name as tgfName,
  917. tc.f_name as tcfName,
  918. tw.f_qty as fQty,
  919. twb.f_netweight as fNetweight,
  920. twb.f_volumn as fVolumn,
  921. DATE_FORMAT(twb.f_originalbilldate, '%Y-%m-%d') fOriginalbilldate,
  922. DATE_FORMAT(twb.f_bsdate, '%Y-%m-%d') fBsdate,
  923. twb.f_billing_days as fBillingdays,
  924. tw.f_amount as fAmount,
  925. twb.create_by as createBy,
  926. DATE_FORMAT(twb.f_chargedate, '%Y-%m-%d') fChargedate,
  927. DATE_FORMAT(tw.f_stlamount_date, '%Y-%m-%d') fStlamountdate,
  928. tw.f_warehouseid as fWarehouseId,
  929. twb.remark as remark
  930. from t_warehousebillsfees tw
  931. LEFT JOIN t_warehousebillsitems twb on twb.f_pid = tw.f_id
  932. LEFT JOIN t_warehousebillsfees_logger twl on twl.f_pid = tw.f_id
  933. LEFT JOIN t_goods tg on twb.f_goodsid = tg.f_id
  934. LEFT JOIN t_corps tc on tw.f_corpid = tc.f_id
  935. <where>
  936. <if test="fCorpid != null and fCorpid != ''">and tw.f_corpid = #{fCorpid}</if>
  937. </where>
  938. </select>
  939. </mapper>