TFeeMapper.xml 143 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956
  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.finance.mapper.TFeeMapper">
  6. <resultMap type="TFee" id="TFeeResult">
  7. <result property="fId" column="f_id"/>
  8. <result property="fBillno" column="f_billno"/>
  9. <result property="fCtrlcorpid" column="f_ctrlcorpid"/>
  10. <result property="fActId" column="f_act_id"/>
  11. <result property="fCorpid" column="f_corpid"/>
  12. <result property="tMblno" column="t_mblno"/>
  13. <result property="fTransActId" column="f_trans_act_id"/>
  14. <result property="fAmtdr" column="f_amtdr"/>
  15. <result property="fAmtcr" column="f_amtcr"/>
  16. <result property="fBilltype" column="f_billtype"/>
  17. <result property="fBillstatus" column="f_billstatus"/>
  18. <result property="fRemarks" column="f_remarks"/>
  19. <result property="fFromDate" column="f_from_date"/>
  20. <result property="fToDate" column="f_to_date"/>
  21. <result property="fAccbilldate" column="f_accbilldate"/>
  22. <result property="fRefNo" column="f_ref_no"/>
  23. <result property="delFlag" column="del_flag"/>
  24. <result property="createBy" column="create_by"/>
  25. <result property="fDeptid" column="f_deptid"/>
  26. <result property="createTime" column="create_time"/>
  27. <result property="updateBy" column="update_by"/>
  28. <result property="updateTime" column="update_time"/>
  29. <result property="chargingMethod" column="charging_method"/>
  30. <result property="fTotalamount" column="f_totalamount"/>
  31. <result property="invoiceNo" column="invoice_no"/>
  32. <result property="bank" column="bank"/>
  33. <result property="waterBillNo" column="water_bill_no"/>
  34. <result property="fSystemType" column="f_system_type"/>
  35. <result property="fTrackingNumber" column="f_tracking_number"/>
  36. <result property="fInvoiceRise" column="f_invoice_rise"/>
  37. <result property="fSign" column="f_sign"/>
  38. <result property="fSendTime" column="f_send_Time"/>
  39. <result property="fApplyMoney" column="f_apply_money"/>
  40. <result property="fAccountId" column="f_account_id"/>
  41. <result property="fMake" column="f_make"/>
  42. <result property="fVslid" column="f_vslid"/>
  43. <result property="fVoyid" column="f_voyid"/>
  44. <result property="fLoadportid" column="f_loadportid"/>
  45. <result property="fDestportid" column="f_destportid"/>
  46. <result property="fDc" column="f_dc"/>
  47. <result property="fBankNumber" column="f_bank_number"/>
  48. <result property="fReconciliation" column="f_reconciliation"/>
  49. <result property="invoiceRemarks" column="invoice_remarks"/>
  50. </resultMap>
  51. <resultMap type="FeeVO" id="feeVOResult">
  52. <result property="fId" column="f_id"/>
  53. <result property="fBillno" column="f_billno"/>
  54. <result property="fCtrlcorpid" column="f_ctrlcorpid"/>
  55. <result property="fActId" column="f_act_id"/>
  56. <result property="fCorpid" column="f_corpid"/>
  57. <result property="tMblno" column="t_mblno"/>
  58. <result property="fTransActId" column="f_trans_act_id"/>
  59. <result property="fAmtdr" column="f_amtdr"/>
  60. <result property="fAmtcr" column="f_amtcr"/>
  61. <result property="fBilltype" column="f_billtype"/>
  62. <result property="fBillstatus" column="f_billstatus"/>
  63. <result property="fRemarks" column="f_remarks"/>
  64. <result property="fFromDate" column="f_from_date"/>
  65. <result property="fToDate" column="f_to_date"/>
  66. <result property="fAccbilldate" column="f_accbilldate"/>
  67. <result property="fRefNo" column="f_ref_no"/>
  68. <result property="delFlag" column="del_flag"/>
  69. <result property="createBy" column="create_by"/>
  70. <result property="fDeptid" column="f_deptid"/>
  71. <result property="createTime" column="create_time"/>
  72. <result property="updateBy" column="update_by"/>
  73. <result property="updateTime" column="update_time"/>
  74. <result property="chargingMethod" column="charging_method"/>
  75. <result property="fTotalamount" column="f_totalamount"/>
  76. <result property="fSrcBillno" column="f_src_billno"/>
  77. <result property="invoiceNo" column="invoice_no"/>
  78. <result property="bank" column="bank"/>
  79. <result property="waterBillNo" column="water_bill_no"/>
  80. <result property="fSystemType" column="f_system_type"/>
  81. <result property="fTrackingNumber" column="f_tracking_number"/>
  82. <result property="fInvoiceRise" column="f_invoice_rise"/>
  83. <result property="fSign" column="f_sign"/>
  84. <result property="fSendTime" column="f_send_Time"/>
  85. <result property="fApplyMoney" column="f_apply_money"/>
  86. <result property="fAccountId" column="f_account_id"/>
  87. <result property="fMake" column="f_make"/>
  88. <result property="fVslid" column="f_vslid"/>
  89. <result property="fVoyid" column="f_voyid"/>
  90. <result property="fLoadportid" column="f_loadportid"/>
  91. <result property="fDestportid" column="f_destportid"/>
  92. <result property="fDc" column="f_dc"/>
  93. <result property="fBankNumber" column="f_bank_number"/>
  94. <result property="fReconciliation" column="f_reconciliation"/>
  95. <result property="invoiceRemarks" column="invoice_remarks"/>
  96. <result property="invoiceRemarks" column="invoice_remarks"/>
  97. <result property="fFeesName" column="f_fees_name"/>
  98. <result property="fAmount" column="f_amount"/>
  99. <result property="fStlamount" column="f_stlamount"/>
  100. <result property="storageFee" column="storage_fee"/>
  101. <result property="otherFee" column="other_fee"/>
  102. <result property="fSrcpid" column="f_srcpid"/>
  103. <result property="fMblno" column="f_mblno"/>
  104. <result property="fMarks" column="f_marks"/>
  105. <result property="fProductName" column="f_product_name"/>
  106. <result property="fReviewDate" column="f_review_date"/>
  107. <result property="fBstime" column="f_bstime"/>
  108. <result property="fAccamount" column="f_accamount"/>
  109. <result property="fInvamount" column="f_invamount"/>
  110. <result property="price" column="f_unitprice"/>
  111. <result property="fBillingDays" column="f_inventory_days"/>
  112. <result property="fQty" column="f_qty"/>
  113. <result property="name" column="f_name"/>
  114. </resultMap>
  115. <sql id="selectTFeeVo">
  116. select f_id,
  117. f_billno,
  118. f_ctrlcorpid,
  119. f_act_id,
  120. f_corpid,
  121. t_mblno,
  122. f_trans_act_id,
  123. f_amtdr,
  124. f_amtcr,
  125. f_billtype,
  126. f_billstatus,
  127. f_remarks,
  128. f_from_date,
  129. f_to_date,
  130. f_accbilldate,
  131. f_ref_no,
  132. del_flag,
  133. create_by,
  134. f_deptid,
  135. create_time,
  136. update_by,
  137. update_time,
  138. charging_method,
  139. f_totalamount,
  140. invoice_no,
  141. bank,
  142. water_bill_no,
  143. f_system_type,
  144. f_tracking_number,
  145. f_invoice_rise,
  146. f_sign,
  147. f_send_Time,
  148. f_apply_money,
  149. f_account_id,
  150. f_make,
  151. f_vslid,
  152. f_voyid,
  153. f_loadportid,
  154. f_destportid,
  155. f_dc,
  156. f_bank_number,
  157. f_reconciliation,
  158. invoice_remarks
  159. from t_fee
  160. </sql>
  161. <select id="selectTFeeList" parameterType="TFee" resultMap="TFeeResult">
  162. select
  163. ware.f_id,
  164. ware.f_billno,
  165. ware.f_ctrlcorpid,
  166. ware.f_act_id,
  167. ware.f_corpid,
  168. ware.t_mblno,
  169. ware.f_trans_act_id,
  170. ware.f_amtdr,
  171. ware.f_amtcr,
  172. ware.f_billtype,
  173. CASE
  174. WHEN ware.f_billstatus = '1' THEN '新建'
  175. WHEN ware.f_billstatus = '2' THEN '暂存'
  176. WHEN ware.f_billstatus = '3' THEN '审批驳回'
  177. WHEN ware.f_billstatus = '4' THEN '提交审核'
  178. WHEN ware.f_billstatus = '5' THEN '审核中'
  179. WHEN ware.f_billstatus = '6' THEN '审核完成'
  180. END
  181. AS f_billstatus,
  182. ware.f_remarks,
  183. ware.f_from_date,
  184. ware.f_to_date,
  185. ware.f_accbilldate,
  186. ware.f_ref_no,
  187. ware.del_flag,
  188. ware.create_by,
  189. ware.f_deptid,
  190. ware.create_time,
  191. ware.update_by,
  192. ware.update_time,
  193. pro.dict_label AS charging_method,
  194. ware.f_totalamount AS f_totalamount,
  195. ware.invoice_no,
  196. ware.bank,
  197. ware.water_bill_no,
  198. ware.f_system_type,
  199. ware.f_apply_money as fApplyMoney
  200. from
  201. t_fee ware
  202. left join sys_user u on ware.create_by = u.user_name
  203. left join sys_dept d on ware.f_deptid = d.dept_id
  204. LEFT JOIN sys_dict_data pro ON pro.dict_value = ware.charging_method and pro.dict_type = 'data_settlement_type'
  205. <where>
  206. <if test="fBillno != null and fBillno != ''">and ware.f_billno like concat('%', #{ fBillno}, '%') </if>
  207. <if test="fCtrlcorpid != null ">and ware.f_ctrlcorpid = #{fCtrlcorpid}</if>
  208. <if test="fActId != null ">and ware.f_act_id = #{fActId}</if>
  209. <if test="fCorpid != null ">and ware.f_corpid = #{fCorpid}</if>
  210. <if test="fTransActId != null ">and ware.f_trans_act_id = #{fTransActId}</if>
  211. <if test="tMblno != null and tMblno != ''">and t_mblno = #{tMblno}</if>
  212. <if test="fAmtdr != null ">and ware.f_amtdr = #{fAmtdr}</if>
  213. <if test="fAmtcr != null ">and ware.f_amtcr = #{fAmtcr}</if>
  214. <if test="fBilltype != null and fBilltype != ''">and ware.f_billtype = #{fBilltype}</if>
  215. <if test="fBillstatus != null and fBillstatus != ''">and ware.f_billstatus = #{fBillstatus}</if>
  216. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%')</if>
  217. <if test="fFromDate != null ">and ware.f_from_date = #{fFromDate}</if>
  218. <if test="fAccbilldate != null ">and ware.f_accbilldate = #{fAccbilldate}</if>
  219. <if test="fToDate != null ">and ware.f_to_date = #{fToDate}</if>
  220. <if test="fRefNo != null and fRefNo != ''">and ware.f_ref_no = #{fRefNo}</if>
  221. <if test="fDeptid != null ">and ware.f_deptid = #{fDeptid}</if>
  222. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  223. and ware.f_accbilldate &gt;= #{timeInterval[0]}
  224. </if>
  225. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  226. and ware.f_accbilldate &lt;= #{timeInterval[1]}
  227. </if>
  228. <if test='amount != null and amount[0] != null and amount[0]!= ""'>
  229. and ware.f_amtdr &gt;= #{amount[0]}
  230. </if>
  231. <if test='amount != null and amount[1] != null and amount[1]!= ""'>
  232. and ware.f_amtdr &lt;= #{amount[1]}
  233. </if>
  234. <if test="chargingMethod != null ">and ware.charging_method = #{chargingMethod}</if>
  235. <if test="fTotalamount != null ">and ware.f_totalamount = #{fTotalamount}</if>
  236. <if test="invoiceNo != null ">and ware.invoice_no = #{invoiceNo}</if>
  237. <if test="bank != null ">and ware.bank = #{bank}</if>
  238. <if test="waterBillNo != null ">and ware.water_bill_no = #{waterBillNo}</if>
  239. <if test="fSystemType != null and fSystemType != ''">and ware.f_system_type = #{fSystemType}</if>
  240. </where>
  241. ${params.dataScope}
  242. ORDER BY ware.f_id desc
  243. </select>
  244. <select id="selectTFeeList1" parameterType="TFee" resultType="Map">
  245. SELECT
  246. f.f_id AS fId,
  247. f.f_billno AS fBillno,
  248. fd.f_src_billno AS fSrcBillno,
  249. f.f_ctrlcorpid AS fCtrlcorpid,
  250. pro.dict_label AS chargingMethod,
  251. f.invoice_no AS invoiceNo,
  252. f.bank,
  253. f.water_bill_no AS waterBillNo,
  254. f.f_corpid AS fCorpid,
  255. c.f_name AS fCorpidName,
  256. f.f_accbilldate AS fAccbilldate,
  257. f.t_mblno AS tMblno,
  258. SUM(fd.f_amtdr) AS fAmtdr,
  259. SUM(fd.f_amt) AS fAmtcr,
  260. f.f_billtype AS fBilltype,
  261. f.f_system_type AS fSystemType,
  262. CASE
  263. WHEN f.f_billstatus = '1' THEN '新建'
  264. WHEN f.f_billstatus = '2' THEN '暂存'
  265. WHEN f.f_billstatus = '3' THEN '审批驳回'
  266. WHEN f.f_billstatus = '4' THEN '提交审核'
  267. WHEN f.f_billstatus = '5' THEN '审核中'
  268. WHEN f.f_billstatus = '6' THEN '审核完成'
  269. END
  270. AS fBillstatus,
  271. f.f_remarks AS fRemarks,
  272. f.create_by AS createBy,
  273. tp.f_name AS createName,
  274. f.create_time createTime,
  275. f.update_by updateBy,
  276. f.update_time
  277. FROM
  278. t_fee AS f
  279. LEFT JOIN t_fee_do AS fd ON fd.f_pid = f.f_id
  280. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  281. left join sys_user u on f.create_by = u.user_name
  282. left join sys_dept d on f.f_deptid = d.dept_id
  283. LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
  284. LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
  285. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.charging_method and pro.dict_type = 'data_settlement_type'
  286. <where>
  287. <if test="fId != null ">and f.f_id = #{fId}</if>
  288. <if test="fBillno != null and fBillno != ''">and f.f_billno = #{fBillno}</if>
  289. <if test="fSrcBillno != null and fSrcBillno != ''">and fd.f_src_billno like concat('%', #{fSrcBillno}, '%')</if>
  290. <if test="fCtrlcorpid != null ">and f.f_ctrlcorpid = #{fCtrlcorpid}</if>
  291. <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
  292. <if test="tMblno != null and tMblno != ''">and f.t_mblno = #{tMblno}</if>
  293. <if test="fAmtdr != null ">and f.f_amtdr = #{fAmtdr}</if>
  294. <if test="fAmtcr != null ">and f.f_amtcr = #{fAmtcr}</if>
  295. <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
  296. <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
  297. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%')</if>
  298. <if test="fAccbilldate != null ">and f.f_accbilldate = #{fAccbilldate}</if>
  299. <if test="fDeptid != null ">and f.f_deptid = #{fDeptid}</if>
  300. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  301. and f.f_accbilldate &gt;= #{timeInterval[0]}
  302. </if>
  303. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  304. and f.f_accbilldate &lt;= #{timeInterval[1]}
  305. </if>
  306. <if test='money != null and money[0] != null and money[0]!= ""'>
  307. and f.f_amtdr &gt;= #{money[0]}
  308. </if>
  309. <if test='money != null and money[1] != null and money[1]!= ""'>
  310. and f.f_amtdr &lt;= #{money[1]}
  311. </if>
  312. <if test='amount != null and amount[0] != null and amount[0]!= ""'>
  313. and f.f_amtdr &gt;= #{amount[0]}
  314. </if>
  315. <if test='amount != null and amount[1] != null and amount[1]!= ""'>
  316. and f.f_amtdr &lt;= #{amount[1]}
  317. </if>
  318. <if test='applyTime != null and applyTime[0] != null and applyTime[0]!= ""'>
  319. and f.create_time &gt;= #{applyTime[0]}
  320. </if>
  321. <if test='applyTime != null and applyTime[1] != null and applyTime[1]!= ""'>
  322. and f.create_time &lt;= #{applyTime[1]}
  323. </if>
  324. <if test="chargingMethod != null ">and f.charging_method = #{chargingMethod}</if>
  325. <if test="fTotalamount != null ">and f.f_totalamount = #{fTotalamount}</if>
  326. <if test="invoiceNo != null ">and f.invoice_no = #{invoiceNo}</if>
  327. <if test="bank != null ">and f.bank = #{bank}</if>
  328. <if test="waterBillNo != null ">and f.water_bill_no = #{waterBillNo}</if>
  329. <if test="fSystemType != null and fSystemType != ''">and f.f_system_type = #{fSystemType}</if>
  330. <if test="createBy != null and createBy != ''">and f.create_by = #{createBy}</if>
  331. </where>
  332. ${params.dataScope}
  333. GROUP BY f.f_billno
  334. ORDER BY f.f_id desc
  335. </select>
  336. <!--凯和查询财务信息-->
  337. <select id="selectFinancialTFeeList" parameterType="TFee" resultType="com.ruoyi.finance.shipping.FinancialTFee">
  338. SELECT
  339. DISTINCT
  340. f.f_id AS fId,
  341. f.f_billno AS fBillno,
  342. f.f_ctrlcorpid AS fCtrlcorpid,
  343. pro.dict_label AS chargingMethod,
  344. f.invoice_no AS invoiceNo,
  345. f.bank AS fBank,
  346. f.water_bill_no AS waterBillNo,
  347. f.f_corpid AS fCorpid,
  348. c.f_name AS fCorpidName,
  349. f.f_accbilldate AS fAccbilldate,
  350. f.t_mblno AS tMblno,
  351. f.f_amtdr AS fAmtdr,
  352. f.f_amtcr AS fAmtcr,
  353. f.f_billtype AS fBilltype,
  354. f.f_system_type AS fSystemType,
  355. f.f_billstatus AS fBillstatus,
  356. CASE
  357. WHEN f.f_billstatus = '1' THEN '新建'
  358. WHEN f.f_billstatus = '2' THEN '暂存'
  359. WHEN f.f_billstatus = '3' THEN '审批驳回'
  360. WHEN f.f_billstatus = '4' THEN '提交审核'
  361. WHEN f.f_billstatus = '5' THEN '审核中'
  362. WHEN f.f_billstatus = '6' THEN '审核完成'
  363. END
  364. AS fBillstatusName,
  365. f.f_remarks AS fRemarks,
  366. f.create_by AS createBy,
  367. f.create_time AS createTime,
  368. f.update_by AS updateBy,
  369. f.update_time AS updateTime,
  370. tv.f_name AS vessel,
  371. ty.f_no AS voyage,
  372. tre.f_name AS loadportName,
  373. ts.f_name AS destportName,
  374. f.f_bank_number AS fBankNumber,
  375. f.bank AS bank,
  376. f.invoice_remarks AS invoiceRemarks,
  377. CASE
  378. WHEN f.f_dc = 'D' THEN
  379. '收'
  380. WHEN f.f_dc = 'C' THEN
  381. '付'
  382. END AS fSrcdcName
  383. FROM
  384. t_fee AS f
  385. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  386. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.charging_method and pro.dict_type = 'data_settlement_type'
  387. LEFT JOIN t_vessel tv ON f.f_vslid = tv.f_id
  388. LEFT JOIN t_voyage ty ON f.f_voyid = ty.f_id
  389. LEFT JOIN t_address tre ON tre.f_id = f.f_loadportid
  390. LEFT JOIN t_address ts ON ts.f_id = f.f_destportid
  391. LEFT JOIN t_fee_do tf ON tf.f_pid = f.f_id
  392. LEFT JOIN t_warehousebillsfees tb ON tb.f_id = tf.f_srcid
  393. <where>
  394. <if test="fId != null ">and f.f_id = #{fId}</if>
  395. <if test="fBillno != null and fBillno != ''">and f.f_billno like concat('%', #{fBillno}, '%')</if>
  396. <if test="fCtrlcorpid != null and fCtrlcorpid != ''">and f.f_ctrlcorpid = #{fCtrlcorpid}</if>
  397. <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
  398. <if test="tMblno != null and tMblno != ''">and tb.f_mblno like concat('%', #{tMblno}, '%')</if>
  399. <if test="fAmtdr != null ">and f.f_amtdr = #{fAmtdr}</if>
  400. <if test="fAmtcr != null ">and f.f_amtcr = #{fAmtcr}</if>
  401. <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
  402. <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
  403. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%')</if>
  404. <if test="fAccbilldate != null ">and f.f_accbilldate = #{fAccbilldate}</if>
  405. <if test="fDeptid != null ">and f.f_deptid = #{fDeptid}</if>
  406. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  407. and f.f_accbilldate &gt;= #{timeInterval[0]}
  408. </if>
  409. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  410. and f.f_accbilldate &lt;= #{timeInterval[1]}
  411. </if>
  412. <if test='money != null and money[0] != null and money[0]!= ""'>
  413. and f.f_amtdr &gt;= #{money[0]}
  414. </if>
  415. <if test='money != null and money[1] != null and money[1]!= ""'>
  416. and f.f_amtdr &lt;= #{money[1]}
  417. </if>
  418. <if test='amount != null and amount[0] != null and amount[0]!= ""'>
  419. and f.f_amtdr &gt;= #{amount[0]}
  420. </if>
  421. <if test='amount != null and amount[1] != null and amount[1]!= ""'>
  422. and f.f_amtdr &lt;= #{amount[1]}
  423. </if>
  424. <if test='applyTime != null and applyTime[0] != null and applyTime[0]!= ""'>
  425. and f.create_time &gt;= #{applyTime[0]}
  426. </if>
  427. <if test='applyTime != null and applyTime[1] != null and applyTime[1]!= ""'>
  428. and f.create_time &lt;= #{applyTime[1]}
  429. </if>
  430. <if test="chargingMethod != null ">and f.charging_method = #{chargingMethod}</if>
  431. <if test="fTotalamount != null ">and f.f_totalamount = #{fTotalamount}</if>
  432. <if test="invoiceNo != null ">and f.invoice_no like concat('%', #{invoiceNo}, '%')</if>
  433. <if test="bank != null ">and f.bank like concat('%', #{bank}, '%')</if>
  434. <if test="waterBillNo != null ">and f.water_bill_no like concat('%', #{waterBillNo}, '%')</if>
  435. <if test="fSystemType != null and fSystemType != ''">and f.f_system_type = #{fSystemType}</if>
  436. <if test="createBy != null and createBy != ''">and f.create_by = #{createBy}</if>
  437. <if test="fVslid != null ">and f.f_vslid = #{fVslid}</if>
  438. <if test="fVoyid != null ">and f.f_voyid = #{fVoyid}</if>
  439. <if test="fLoadportid != null ">and f.f_loadportid = #{fLoadportid}</if>
  440. <if test="fDestportid != null ">and f.f_destportid = #{fDestportid}</if>
  441. <if test="fDc != null and fDc != ''">and f.f_dc = #{fDc}</if>
  442. <if test="fBankNumber != null and fBankNumber != ''">and f.f_bank_number like concat('%', #{fBankNumber},
  443. '%')
  444. </if>
  445. <if test="fReconciliation != null ">and f.f_reconciliation = #{fReconciliation}</if>
  446. </where>
  447. ORDER BY f.f_id desc
  448. </select>
  449. <select id="selectTFeeById" parameterType="Long" resultMap="TFeeResult">
  450. select f.f_id,
  451. f.f_billno,
  452. f.f_ctrlcorpid,
  453. f.f_act_id,
  454. f.f_corpid,
  455. c.f_name AS fCorpidName,
  456. f.t_mblno,
  457. f.f_trans_act_id,
  458. f.f_amtdr,
  459. f.f_amtcr,
  460. f.f_billtype,
  461. f.f_billstatus,
  462. f.f_remarks,
  463. f.f_from_date,
  464. f.f_to_date,
  465. f.f_accbilldate,
  466. f.f_ref_no,
  467. f.del_flag,
  468. f.create_by,
  469. f.f_deptid,
  470. f.create_time,
  471. f.update_by,
  472. f.update_time,
  473. f.charging_method,
  474. f.f_totalamount,
  475. f.invoice_no,
  476. f.bank,
  477. f.water_bill_no,
  478. f.f_system_type,
  479. f.f_tracking_number,
  480. f.f_invoice_rise,
  481. f.f_sign,
  482. f.f_send_Time,
  483. f.f_apply_money,
  484. f.f_account_id,
  485. f.f_make,
  486. f.f_vslid,
  487. f.f_voyid,
  488. f.f_loadportid,
  489. f.f_destportid,
  490. f.f_dc,
  491. f.f_bank_number,
  492. f.f_reconciliation,
  493. f.invoice_remarks
  494. from t_fee AS f
  495. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  496. where f.f_id = #{fId}
  497. </select>
  498. <select id="selectTFeeByIdNew" parameterType="Long" resultMap="TFeeResult">
  499. SELECT f.f_id,
  500. f.f_billno,
  501. f.f_ctrlcorpid,
  502. f.f_corpid,
  503. c.f_name AS fCorpidName,
  504. f.f_accbilldate,
  505. f.t_mblno,
  506. f.f_amtdr,
  507. f.f_amtcr,
  508. f.f_billtype,
  509. f.f_system_type,
  510. f.f_billstatus,
  511. f.f_remarks,
  512. f.create_by,
  513. tp.f_name AS createName,
  514. f.create_time,
  515. f.update_by,
  516. f.update_time,
  517. tn.f_taxrate AS fTaxrate,
  518. f.charging_method,
  519. f.f_totalamount,
  520. f.invoice_no,
  521. f.bank,
  522. f.water_bill_no
  523. FROM t_fee AS f
  524. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  525. left join sys_user u on f.create_by = u.user_name
  526. left join sys_dept d on f.f_deptid = d.dept_id
  527. LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
  528. LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
  529. LEFT JOIN(SELECT ti.f_pid, ti.f_taxrate FROM t_fee_invoice ti LIMIT 1) tn ON tn.f_pid = f.f_id
  530. where f.f_id = #{fId}
  531. </select>
  532. <!--凯和确认账单查询-->
  533. <select id="webVersionTFee" parameterType="TFee" resultType="map">
  534. SELECT
  535. f.f_id AS fId,
  536. f.f_billno AS fBillno,
  537. f.f_ctrlcorpid AS fCtrlcorpid,
  538. c.f_name AS fCorpidName,
  539. f.f_accbilldate AS fAccbilldate,
  540. f.t_mblno AS tMblno,
  541. f.f_amtdr AS fAmtdr,
  542. f.f_amtcr AS fAmtcr,
  543. f.f_billtype AS filltype,
  544. f.f_remarks AS fRemarks,
  545. f.create_by AS createBy,
  546. tp.f_name AS createName,
  547. f.create_time AS createTime,
  548. f.update_by AS updateBy,
  549. f.update_time AS updateTime,
  550. tn.f_taxrate AS fTaxrate,
  551. f.charging_method AS chargingMethod,
  552. f.f_totalamount AS fTotalamount,
  553. f.invoice_no AS invoiceNo,
  554. f.bank AS bank,
  555. f.water_bill_no AS waterBillNo,
  556. CASE
  557. WHEN f.f_billstatus = '1' THEN '新建'
  558. WHEN f.f_billstatus = '2' THEN '暂存'
  559. WHEN f.f_billstatus = '3' THEN '审批驳回'
  560. WHEN f.f_billstatus = '4' THEN '提交审核'
  561. WHEN f.f_billstatus = '5' THEN '审核中'
  562. WHEN f.f_billstatus = '6' THEN '审核完成'
  563. END
  564. AS fBillstatus
  565. FROM
  566. t_fee AS f
  567. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  568. left join sys_user u on f.create_by = u.user_name
  569. left join sys_dept d on f.f_deptid = d.dept_id
  570. LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
  571. LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
  572. LEFT JOIN(SELECT ti.f_pid,ti.f_taxrate FROM t_fee_invoice ti LIMIT 1) tn ON tn.f_pid = f.f_id
  573. <where>
  574. f.f_make = 0
  575. <if test="fId != null ">and f.f_id = #{fId}</if>
  576. <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
  577. <if test="createId != null ">and tp.f_id = #{createId}</if>
  578. <if test="createBy != null and createBy != ''">and f.create_by = #{createBy}</if>
  579. <if test="fCtrlcorpid != null and fCtrlcorpid != ''">and f.f_ctrlcorpid like concat('%',
  580. #{fCtrlcorpid},'%')
  581. </if>
  582. <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
  583. <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
  584. <if test="fBillno != null and fBillno != ''">and f.f_billno = #{fBillno}</if>
  585. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  586. and f.f_accbilldate &gt;= #{timeInterval[0]}
  587. </if>
  588. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  589. and f.f_accbilldate &lt;= #{timeInterval[1]}
  590. </if>
  591. </where>
  592. ORDER BY f.f_id desc
  593. </select>
  594. <insert id="insertTFee" parameterType="TFee" useGeneratedKeys="true" keyProperty="fId">
  595. insert into t_fee
  596. <trim prefix="(" suffix=")" suffixOverrides=",">
  597. <if test="fId != null">f_id,</if>
  598. <if test="fBillno != null">f_billno,</if>
  599. <if test="fCtrlcorpid != null">f_ctrlcorpid,</if>
  600. <if test="fActId != null">f_act_id,</if>
  601. <if test="fCorpid != null">f_corpid,</if>
  602. <if test="tMblno != null">t_mblno,</if>
  603. <if test="fTransActId != null">f_trans_act_id,</if>
  604. <if test="fAmtdr != null">f_amtdr,</if>
  605. <if test="fAmtcr != null">f_amtcr,</if>
  606. <if test="fBilltype != null and fBilltype != ''">f_billtype,</if>
  607. <if test="fBillstatus != null and fBillstatus != ''">f_billstatus,</if>
  608. <if test="fRemarks != null">f_remarks,</if>
  609. <if test="fFromDate != null">f_from_date,</if>
  610. <if test="fToDate != null">f_to_date,</if>
  611. <if test="fAccbilldate != null">f_accbilldate,</if>
  612. <if test="fRefNo != null">f_ref_no,</if>
  613. <if test="delFlag != null">del_flag,</if>
  614. <if test="createBy != null">create_by,</if>
  615. <if test="fDeptid != null">f_deptid,</if>
  616. <if test="createTime != null">create_time,</if>
  617. <if test="updateBy != null">update_by,</if>
  618. <if test="updateTime != null">update_time,</if>
  619. <if test="chargingMethod != null">charging_method,</if>
  620. <if test="fTotalamount != null">f_totalamount,</if>
  621. <if test="invoiceNo != null">invoice_no,</if>
  622. <if test="bank != null">bank,</if>
  623. <if test="waterBillNo != null">water_bill_no,</if>
  624. <if test="fSystemType != null">f_system_type,</if>
  625. <if test="fTrackingNumber != null">f_tracking_number,</if>
  626. <if test="fInvoiceRise != null">f_invoice_rise,</if>
  627. <if test="fSign != null">f_sign,</if>
  628. <if test="fSendTime != null">f_send_Time,</if>
  629. <if test="fApplyMoney != null">f_apply_money,</if>
  630. <if test="fAccountId != null">f_account_id,</if>
  631. <if test="fMake != null">f_make,</if>
  632. <if test="fVslid != null">f_vslid,</if>
  633. <if test="fVoyid != null">f_voyid,</if>
  634. <if test="fLoadportid != null">f_loadportid,</if>
  635. <if test="fDestportid != null">f_destportid,</if>
  636. <if test="fDc != null">f_dc,</if>
  637. <if test="fBankNumber != null">f_bank_number,</if>
  638. <if test="fReconciliation != null">f_reconciliation,</if>
  639. <if test="invoiceRemarks != null">invoice_remarks,</if>
  640. </trim>
  641. <trim prefix="values (" suffix=")" suffixOverrides=",">
  642. <if test="fId != null">#{fId},</if>
  643. <if test="fBillno != null">#{fBillno},</if>
  644. <if test="fCtrlcorpid != null">#{fCtrlcorpid},</if>
  645. <if test="fActId != null">#{fActId},</if>
  646. <if test="fCorpid != null">#{fCorpid},</if>
  647. <if test="tMblno != null">#{tMblno},</if>
  648. <if test="fTransActId != null">#{fTransActId},</if>
  649. <if test="fAmtdr != null">#{fAmtdr},</if>
  650. <if test="fAmtcr != null">#{fAmtcr},</if>
  651. <if test="fBilltype != null and fBilltype != ''">#{fBilltype},</if>
  652. <if test="fBillstatus != null and fBillstatus != ''">#{fBillstatus},</if>
  653. <if test="fRemarks != null">#{fRemarks},</if>
  654. <if test="fFromDate != null">#{fFromDate},</if>
  655. <if test="fToDate != null">#{fToDate},</if>
  656. <if test="fAccbilldate != null">#{fAccbilldate},</if>
  657. <if test="fRefNo != null">#{fRefNo},</if>
  658. <if test="delFlag != null">#{delFlag},</if>
  659. <if test="createBy != null">#{createBy},</if>
  660. <if test="fDeptid != null">#{fDeptid},</if>
  661. <if test="createTime != null">#{createTime},</if>
  662. <if test="updateBy != null">#{updateBy},</if>
  663. <if test="updateTime != null">#{updateTime},</if>
  664. <if test="chargingMethod != null">#{chargingMethod},</if>
  665. <if test="fTotalamount != null">#{fTotalamount},</if>
  666. <if test="invoiceNo != null">#{invoiceNo},</if>
  667. <if test="bank != null">#{bank},</if>
  668. <if test="waterBillNo != null">#{waterBillNo},</if>
  669. <if test="fSystemType != null">#{fSystemType},</if>
  670. <if test="fTrackingNumber != null">#{fTrackingNumber},</if>
  671. <if test="fInvoiceRise != null">#{fInvoiceRise},</if>
  672. <if test="fSign != null">#{fSign},</if>
  673. <if test="fSendTime != null">#{fSendTime},</if>
  674. <if test="fApplyMoney != null">#{fApplyMoney},</if>
  675. <if test="fAccountId != null">#{fAccountId},</if>
  676. <if test="fMake != null">#{fMake},</if>
  677. <if test="fVslid != null">#{fVslid},</if>
  678. <if test="fVoyid != null">#{fVoyid},</if>
  679. <if test="fLoadportid != null">#{fLoadportid},</if>
  680. <if test="fDestportid != null">#{fDestportid},</if>
  681. <if test="fDc != null">#{fDc},</if>
  682. <if test="fBankNumber != null">#{fBankNumber},</if>
  683. <if test="fReconciliation != null">#{fReconciliation},</if>
  684. <if test="invoiceRemarks != null">#{invoiceRemarks},</if>
  685. </trim>
  686. </insert>
  687. <update id="updateTFee" parameterType="TFee">
  688. update t_fee
  689. <trim prefix="SET" suffixOverrides=",">
  690. <if test="fBillno != null">f_billno = #{fBillno},</if>
  691. <if test="fCtrlcorpid != null">f_ctrlcorpid = #{fCtrlcorpid},</if>
  692. <if test="fActId != null">f_act_id = #{fActId},</if>
  693. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  694. <if test="tMblno != null">t_mblno = #{tMblno},</if>
  695. <if test="fTransActId != null">f_trans_act_id = #{fTransActId},</if>
  696. <if test="fAmtdr != null">f_amtdr = #{fAmtdr},</if>
  697. <if test="fAmtcr != null">f_amtcr = #{fAmtcr},</if>
  698. <if test="fBilltype != null and fBilltype != ''">f_billtype = #{fBilltype},</if>
  699. <if test="fBillstatus != null and fBillstatus != ''">f_billstatus = #{fBillstatus},</if>
  700. <if test="fRemarks != null">f_remarks = #{fRemarks},</if>
  701. <if test="fFromDate != null">f_from_date = #{fFromDate},</if>
  702. <if test="fToDate != null">f_to_date = #{fToDate},</if>
  703. <if test="fAccbilldate != null">f_accbilldate = #{fAccbilldate},</if>
  704. <if test="fRefNo != null">f_ref_no = #{fRefNo},</if>
  705. <if test="delFlag != null">del_flag = #{delFlag},</if>
  706. <if test="createBy != null">create_by = #{createBy},</if>
  707. <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
  708. <if test="createTime != null">create_time = #{createTime},</if>
  709. <if test="updateBy != null">update_by = #{updateBy},</if>
  710. <if test="updateTime != null">update_time = #{updateTime},</if>
  711. <if test="chargingMethod != null">charging_method = #{chargingMethod},</if>
  712. <if test="fTotalamount != null">f_totalamount = #{fTotalamount},</if>
  713. <if test="invoiceNo != null">invoice_no = #{invoiceNo},</if>
  714. <if test="bank != null">bank = #{bank},</if>
  715. <if test="waterBillNo != null">water_bill_no = #{waterBillNo},</if>
  716. <if test="fSystemType != null">f_system_type = #{fSystemType},</if>
  717. <if test="fTrackingNumber != null">f_tracking_number = #{fTrackingNumber},</if>
  718. <if test="fInvoiceRise != null">f_invoice_rise = #{fInvoiceRise},</if>
  719. <if test="fSign != null">f_sign = #{fSign},</if>
  720. <if test="fSendTime != null">f_send_Time = #{fSendTime},</if>
  721. <if test="fApplyMoney != null">f_apply_money = #{fApplyMoney},</if>
  722. <if test="fAccountId != null">f_account_id = #{fAccountId},</if>
  723. <if test="fMake != null">f_make = #{fMake},</if>
  724. <if test="fVslid != null">f_vslid = #{fVslid},</if>
  725. <if test="fVoyid != null">f_voyid = #{fVoyid},</if>
  726. <if test="fLoadportid != null">f_loadportid = #{fLoadportid},</if>
  727. <if test="fDestportid != null">f_destportid = #{fDestportid},</if>
  728. <if test="fDc != null">f_dc = #{fDc},</if>
  729. <if test="fBankNumber != null">f_bank_number = #{fBankNumber},</if>
  730. <if test="fReconciliation != null">f_reconciliation = #{fReconciliation},</if>
  731. <if test="invoiceRemarks != null">invoice_remarks = #{invoiceRemarks},</if>
  732. </trim>
  733. where f_id = #{fId}
  734. </update>
  735. <delete id="deleteTFeeById" parameterType="Long">
  736. delete
  737. from t_fee
  738. where f_id = #{fId}
  739. </delete>
  740. <delete id="deleteTFeeByIds" parameterType="String">
  741. delete
  742. f.*,
  743. fd.* ,
  744. fi.*
  745. from
  746. t_fee f
  747. LEFT JOIN t_fee_do fd ON fd.f_pid = f.f_id
  748. LEFT JOIN t_fee_invoice fi ON fi.f_pid = f.f_id
  749. where f.f_id in
  750. <foreach item="fId" collection="array" open="(" separator="," close=")">
  751. #{fId}
  752. </foreach>
  753. </delete>
  754. <select id="warehouseBillsFeesList" resultType="java.util.Map">
  755. SELECT
  756. w.f_id AS fSrcid,
  757. t.f_id AS fSrcpid,
  758. t.f_corpid AS fCorpid,
  759. t.f_billno AS fBillno,
  760. c.f_name AS fName,
  761. c.f_id AS fId,
  762. c.f_name AS fFeesName,
  763. t.f_bscorpno AS fBscorpno,
  764. w.f_mblno AS fMblno,
  765. w.f_product_name AS fProductName,
  766. w.f_bsdate AS fBsdate,
  767. t.f_billtype AS fBilltype,
  768. t.f_review_date AS fReviewDate,
  769. w.f_feeid AS fFeeid,
  770. w.src_bill_no AS srcBillNo,
  771. w.f_marks AS fMarks,
  772. w.f_chargedate AS fChargedate,
  773. w.f_billing_days AS fBillingDays,
  774. w.f_billing_deadline AS fBillingDeadline,
  775. w.f_inventory_days AS fInventoryDays,
  776. w.f_originalbilldate AS fOriginalbilldate,
  777. f.f_name AS fFeeName,
  778. w.f_qty AS fQty,
  779. w.f_unitprice AS fUnitprice,
  780. w.f_dc AS fSrcdc,
  781. CASE
  782. WHEN w.f_dc = 'D' THEN
  783. '收'
  784. WHEN w.f_dc = 'C' THEN
  785. '付'
  786. END AS fSrcdcName,
  787. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
  788. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
  789. w.f_business_type AS fBusinessType,
  790. w.remark AS fRemarks
  791. FROM
  792. t_warehousebillsfees w
  793. LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
  794. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  795. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  796. <where>
  797. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
  798. #{map.tWareHouseFees.fCorpid}
  799. </if>
  800. <if test="map.tWareHouseFees.stlTypeid != null and map.tWareHouseFees.stlTypeid != ''">and w.f_stltypeid = #{map.tWareHouseFees.stlTypeid}</if>
  801. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  802. #{map.tWareHouseFees.fToCorpid}
  803. </if>
  804. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  805. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  806. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  807. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  808. </if>
  809. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  810. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  811. </if>
  812. <if test="map.tWareHouseFees.fProductName != null and map.tWareHouseFees.fProductName != ''">
  813. and w.f_product_name like concat('%', #{map.tWareHouseFees.fProductName}, '%')
  814. </if>
  815. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  816. and w.f_accamount_date IS NOT NULL
  817. </if>
  818. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  819. and w.f_accamount_date IS NULL
  820. </if>
  821. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  822. and w.f_dc = #{map.tWareHouseFees.fDc}
  823. </if>
  824. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  825. and w.f_dc = #{map.tWareHouseFees.fDc}
  826. </if>
  827. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  828. and w.f_feeid in
  829. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  830. separator=",">
  831. #{id}
  832. </foreach>
  833. </if>
  834. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  835. and w.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  836. </if>
  837. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  838. and w.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  839. </if>
  840. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  841. and w.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  842. </if>
  843. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  844. and w.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  845. </if>
  846. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  847. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  848. </if>
  849. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  850. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  851. </if>
  852. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
  853. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  854. </if>
  855. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
  856. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  857. </if>
  858. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
  859. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  860. </if>
  861. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
  862. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  863. </if>
  864. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  865. and w.f_business_type in
  866. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  867. #{id}
  868. </foreach>
  869. </if>
  870. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  871. and w.f_id in
  872. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  873. separator=",">
  874. #{id}
  875. </foreach>
  876. </if>
  877. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  878. and t.f_id in
  879. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  880. separator=",">
  881. #{id}
  882. </foreach>
  883. </if>
  884. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  885. </if>
  886. and w.f_review_date IS NOT NULL
  887. and abs(IFNULL(w.f_amount, 0) - IFNULL(w.f_stlamount, 0)) &gt; 0
  888. GROUP BY w.f_id
  889. </where>
  890. </select>
  891. <select id="warehouseApplyFPFeesList" resultType="java.util.Map">
  892. SELECT
  893. w.f_id AS fSrcid,
  894. t.f_id AS fSrcpid,
  895. t.f_corpid AS fCorpid,
  896. c.f_name AS fName,
  897. w.fId AS fId,
  898. w.fName AS fFeesName,
  899. t.f_bscorpno AS fBscorpno,
  900. w.f_mblno AS fMblno,
  901. w.f_product_name AS fProductName,
  902. w.f_bsdate AS fBsdate,
  903. t.f_billtype AS fBilltype,
  904. t.f_review_date AS fReviewDate,
  905. w.f_feeid AS fFeeid,
  906. w.src_bill_no AS srcBillNo,
  907. w.f_marks AS fMarks,
  908. w.f_chargedate AS fChargedate,
  909. w.f_billing_days AS fBillingDays,
  910. w.f_billing_deadline AS fBillingDeadline,
  911. w.f_inventory_days AS fInventoryDays,
  912. w.f_originalbilldate AS fOriginalbilldate,
  913. f.f_name AS fFeeName,
  914. w.f_dc AS fSrcdc,
  915. CASE
  916. WHEN w.f_dc = 'D' THEN '收'
  917. WHEN w.f_dc = 'C' THEN '付'
  918. END AS fSrcdcName,
  919. ifnull( w.f_amount, 0 ) - ifnull( w.f_askamount, 0 ) AS fAmtdr,
  920. ifnull( w.f_amount, 0 ) - ifnull( w.f_askamount, 0 ) AS fAmt,
  921. dict.dict_label AS fFeeunitid,
  922. w.f_qty AS fQty,
  923. w.f_unitprice AS fUnitprice,
  924. w.f_currency AS fCurreny,
  925. w.f_taxrate AS fTaxrate,
  926. w.remark AS remark,
  927. tv.f_name AS boatName,
  928. ty.f_no AS voyageName,
  929. w.create_time createTime,
  930. w.businessName,
  931. t.f_loadportid AS fLoadportid,
  932. t.f_destportid AS fDestportid
  933. FROM
  934. t_warehousebills t
  935. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  936. LEFT JOIN (
  937. SELECT
  938. f.f_id AS f_id,
  939. f.f_pid AS f_pid,
  940. f.f_lineno AS f_lineno,
  941. f.f_corpid,
  942. f.f_feeid,
  943. f.f_feeUnitid,
  944. f.f_qty,
  945. f.f_unitprice,
  946. f.f_amount,
  947. f.f_currency,
  948. f.f_exrate,
  949. f.f_taxrate,
  950. f.f_dc,
  951. f.f_billstatus,
  952. f.f_statement_no,
  953. f.f_accamount,
  954. f.f_accamount_date,
  955. f.f_stlamount_no,
  956. f.f_stlamount,
  957. f.f_stlamount_date,
  958. f.f_invnos,
  959. f.f_invamount,
  960. f.f_askamount,
  961. f.f_chargedate,
  962. f.f_status,
  963. f.remark,
  964. f.f_mblno,
  965. f.f_product_name,
  966. f.src_bill_no,
  967. f.f_billing_days,
  968. f.f_inventory_days,
  969. f.f_marks,
  970. f.f_billing_deadline,
  971. f.f_originalbilldate,
  972. f.f_billtype,
  973. f.f_business_type,
  974. pro.dict_label businessName,
  975. f.f_bsdate,
  976. c.f_id AS fId,
  977. c.f_name AS fName,f.create_time
  978. FROM
  979. t_warehousebillsfees AS f
  980. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  981. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.f_business_type
  982. ) w ON w.f_pid = t.f_id
  983. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  984. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  985. LEFT JOIN t_vessel tv ON tv.f_id = t.f_vslid
  986. LEFT JOIN t_voyage ty ON ty.f_id = t.f_voyid
  987. <where>
  988. dict.status = '0'
  989. AND dict.dict_type = 'data_unitfees'
  990. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  991. #{map.tWareHouseFees.fCorpid}
  992. </if>
  993. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  994. #{map.tWareHouseFees.fToCorpid}
  995. </if>
  996. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  997. <if test="map.tWareHouseFees.fLoadportid != null ">and t.f_loadportid = #{map.tWareHouseFees.fLoadportid}
  998. </if>
  999. <if test="map.tWareHouseFees.fDestportid != null ">and t.f_destportid = #{map.tWareHouseFees.fDestportid}
  1000. </if>
  1001. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  1002. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  1003. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  1004. </if>
  1005. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  1006. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  1007. </if>
  1008. <if test="map.tWareHouseFees.fProductName != null and map.tWareHouseFees.fProductName != ''">
  1009. and w.f_product_name like concat('%', #{map.tWareHouseFees.fProductName}, '%')
  1010. </if>
  1011. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  1012. and w.f_accamount_date IS NOT NULL
  1013. </if>
  1014. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  1015. and w.f_accamount_date IS NULL
  1016. </if>
  1017. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  1018. and w.f_dc = #{map.tWareHouseFees.fDc}
  1019. </if>
  1020. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  1021. and w.f_dc = #{map.tWareHouseFees.fDc}
  1022. </if>
  1023. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  1024. and w.f_feeid in
  1025. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  1026. separator=",">
  1027. #{id}
  1028. </foreach>
  1029. </if>
  1030. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  1031. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  1032. </if>
  1033. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  1034. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  1035. </if>
  1036. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
  1037. and w.create_time &gt;= #{map.tWareHouseFees.createTimeList[0]}
  1038. </if>
  1039. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
  1040. and w.create_time &lt;= #{map.tWareHouseFees.createTimeList[1]}
  1041. </if>
  1042. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  1043. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  1044. </if>
  1045. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  1046. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  1047. </if>
  1048. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  1049. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  1050. </if>
  1051. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  1052. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  1053. </if>
  1054. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  1055. and w.f_business_type in
  1056. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  1057. #{id}
  1058. </foreach>
  1059. </if>
  1060. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  1061. and w.f_id in
  1062. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  1063. separator=",">
  1064. #{id}
  1065. </foreach>
  1066. </if>
  1067. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  1068. and t.f_id in
  1069. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  1070. separator=",">
  1071. #{id}
  1072. </foreach>
  1073. </if>
  1074. <if test="map.tWareHouseFees.fVslid != null">and tv.f_vslid = #{map.tWareHouseFees.fVslid}</if>
  1075. <if test="map.tWareHouseFees.fVoyid != null">and ty.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
  1076. <if test="map.tWareHouseFees.boatName != null and map.tWareHouseFees.boatName != ''">and tv.f_name =
  1077. #{map.tWareHouseFees.boatName}
  1078. </if>
  1079. <if test="map.tWareHouseFees.voyageName != null and map.tWareHouseFees.voyageName != ''">and ty.f_no like
  1080. concat('%', #{map.tWareHouseFees.voyageName}, '%')
  1081. </if>
  1082. <if test="map.tWareHouseFees.fName != null and map.tWareHouseFees.fName != ''">and c.f_name like
  1083. concat('%', #{map.tWareHouseFees.fName}, '%')
  1084. </if>
  1085. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  1086. </if>
  1087. and t.f_review_date IS NOT NULL
  1088. and ifnull(w.f_amount, 0) - ifnull(w.f_askamount, 0) > 0
  1089. GROUP BY w.f_id
  1090. </where>
  1091. </select>
  1092. <select id="warehouseInvoiceFPFeesList" resultType="java.util.Map">
  1093. SELECT
  1094. w.f_id AS fSrcid,
  1095. t.f_id AS fSrcpid,
  1096. t.f_corpid AS fCorpid,
  1097. c.f_name AS fName,
  1098. w.fId AS fId,
  1099. w.fName AS fFeesName,
  1100. t.f_bscorpno AS fBscorpno,
  1101. w.f_mblno AS fMblno,
  1102. w.f_product_name AS fProductName,
  1103. w.f_bsdate AS fBsdate,
  1104. t.f_billtype AS fBilltype,
  1105. t.f_review_date AS fReviewDate,
  1106. w.f_feeid AS fFeeid,
  1107. w.src_bill_no AS srcBillNo,
  1108. w.f_marks AS fMarks,
  1109. w.f_chargedate AS fChargedate,
  1110. w.f_billing_days AS fBillingDays,
  1111. w.f_billing_deadline AS fBillingDeadline,
  1112. w.f_inventory_days AS fInventoryDays,
  1113. w.f_originalbilldate AS fOriginalbilldate,
  1114. f.f_name AS fFeeName,
  1115. w.f_dc AS fSrcdc,
  1116. CASE
  1117. WHEN w.f_dc = 'D' THEN '收'
  1118. WHEN w.f_dc = 'C' THEN '付'
  1119. END AS fSrcdcName,
  1120. ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmtdr,
  1121. ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmt,
  1122. dict.dict_label AS fFeeunitid,
  1123. w.f_qty AS fQty,
  1124. w.f_unitprice AS fUnitprice,
  1125. w.f_currency AS fCurreny,
  1126. w.f_taxrate AS fTaxrate,
  1127. w.remark AS remark,
  1128. tv.f_name AS boatName,
  1129. ty.f_no AS voyageName,
  1130. w.create_time createTime,
  1131. w.businessName
  1132. FROM
  1133. t_warehousebills t
  1134. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1135. LEFT JOIN (
  1136. SELECT
  1137. f.f_id AS f_id,
  1138. f.f_pid AS f_pid,
  1139. f.f_lineno AS f_lineno,
  1140. f.f_corpid,
  1141. f.f_feeid,
  1142. f.f_feeUnitid,
  1143. f.f_qty,
  1144. f.f_unitprice,
  1145. f.f_amount,
  1146. f.f_currency,
  1147. f.f_exrate,
  1148. f.f_taxrate,
  1149. f.f_dc,
  1150. f.f_billstatus,
  1151. f.f_statement_no,
  1152. f.f_accamount,
  1153. f.f_accamount_date,
  1154. f.f_stlamount_no,
  1155. f.f_stlamount,
  1156. f.f_stlamount_date,
  1157. f.f_invnos,
  1158. f.f_invamount,
  1159. f.f_askamount,
  1160. f.f_chargedate,
  1161. f.f_status,
  1162. f.remark,
  1163. f.f_mblno,
  1164. f.f_product_name,
  1165. f.src_bill_no,
  1166. f.f_billing_days,
  1167. f.f_inventory_days,
  1168. f.f_marks,
  1169. f.f_billing_deadline,
  1170. f.f_originalbilldate,
  1171. f.f_billtype,
  1172. f.f_business_type,
  1173. pro.dict_label businessName,
  1174. f.f_bsdate,
  1175. c.f_id AS fId,
  1176. c.f_name AS fName,f.create_time
  1177. FROM
  1178. t_warehousebillsfees AS f
  1179. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  1180. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.f_business_type
  1181. ) w ON w.f_pid = t.f_id
  1182. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1183. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  1184. LEFT JOIN t_vessel tv ON tv.f_id = t.f_vslid
  1185. LEFT JOIN t_voyage ty ON ty.f_id = t.f_voyid
  1186. <where>
  1187. dict.status = '0'
  1188. AND dict.dict_type = 'data_unitfees'
  1189. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  1190. #{map.tWareHouseFees.fCorpid}
  1191. </if>
  1192. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  1193. #{map.tWareHouseFees.fToCorpid}
  1194. </if>
  1195. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  1196. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  1197. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  1198. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  1199. </if>
  1200. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  1201. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  1202. </if>
  1203. <if test="map.tWareHouseFees.fProductName != null and map.tWareHouseFees.fProductName != ''">
  1204. and w.f_product_name like concat('%', #{map.tWareHouseFees.fProductName}, '%')
  1205. </if>
  1206. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  1207. and w.f_accamount_date IS NOT NULL
  1208. </if>
  1209. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  1210. and w.f_accamount_date IS NULL
  1211. </if>
  1212. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  1213. and w.f_dc = #{map.tWareHouseFees.fDc}
  1214. </if>
  1215. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  1216. and w.f_dc = #{map.tWareHouseFees.fDc}
  1217. </if>
  1218. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  1219. and w.f_feeid in
  1220. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  1221. separator=",">
  1222. #{id}
  1223. </foreach>
  1224. </if>
  1225. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  1226. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  1227. </if>
  1228. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  1229. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  1230. </if>
  1231. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
  1232. and w.create_time &gt;= #{map.tWareHouseFees.createTimeList[0]}
  1233. </if>
  1234. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
  1235. and w.create_time &lt;= #{map.tWareHouseFees.createTimeList[1]}
  1236. </if>
  1237. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  1238. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  1239. </if>
  1240. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  1241. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  1242. </if>
  1243. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  1244. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  1245. </if>
  1246. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  1247. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  1248. </if>
  1249. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  1250. and w.f_business_type in
  1251. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  1252. #{id}
  1253. </foreach>
  1254. </if>
  1255. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  1256. and w.f_id in
  1257. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  1258. separator=",">
  1259. #{id}
  1260. </foreach>
  1261. </if>
  1262. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  1263. and t.f_id in
  1264. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  1265. separator=",">
  1266. #{id}
  1267. </foreach>
  1268. </if>
  1269. <if test="map.tWareHouseFees.fVslid != null">and tv.f_vslid = #{map.tWareHouseFees.fVslid}</if>
  1270. <if test="map.tWareHouseFees.fVoyid != null">and ty.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
  1271. <if test="map.tWareHouseFees.boatName != null and map.tWareHouseFees.boatName != ''">and tv.f_name =
  1272. #{map.tWareHouseFees.boatName}
  1273. </if>
  1274. <if test="map.tWareHouseFees.voyageName != null and map.tWareHouseFees.voyageName != ''">and ty.f_no =
  1275. #{map.tWareHouseFees.voyageName}
  1276. </if>
  1277. <if test="map.tWareHouseFees.fName != null and map.tWareHouseFees.fName != ''">and c.f_name = like
  1278. concat('%', #{map.tWareHouseFees.fName}, '%')
  1279. </if>
  1280. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  1281. </if>
  1282. and t.f_review_date IS NOT NULL
  1283. and ifnull(w.f_amount, 0) - ifnull(w.f_invamount, 0) > 0
  1284. GROUP BY w.f_id
  1285. </where>
  1286. </select>
  1287. <select id="warehouseBillsFeesListAccamount" resultType="java.util.Map">
  1288. SELECT
  1289. w.f_id AS fSrcid,
  1290. t.f_id AS fSrcpid,
  1291. t.f_corpid AS fCorpid,
  1292. c.f_name AS fName,
  1293. c.f_name AS fFeesName,
  1294. t.f_bscorpno AS fBscorpno,
  1295. t.f_billno AS fBillno,
  1296. w.f_mblno AS fMblno,
  1297. w.f_invnos as invoiceNo,
  1298. w.f_product_name AS fProductName,
  1299. w.f_bsdate AS fBsdate,
  1300. t.f_billtype AS fBilltype,
  1301. t.f_review_date AS fReviewDate,
  1302. w.f_marks AS fMarks,
  1303. w.f_feeid AS fFeeid,
  1304. w.f_billtype AS fBilltype,
  1305. w.f_chargedate AS fChargedate,
  1306. w.f_originalbilldate AS fOriginalbilldate,
  1307. w.f_billing_deadline AS fBillingDeadline,
  1308. w.f_billing_days AS fBillingDays,
  1309. w.f_inventory_days AS fInventoryDays,
  1310. f.f_name AS fFeeName,
  1311. w.f_dc AS fSrcdc,
  1312. CASE
  1313. WHEN w.f_taxrate = 0 THEN '0.00%'
  1314. WHEN w.f_taxrate != 0 THEN CONCAT(w.f_taxrate,'%')
  1315. END AS fTaxrate,
  1316. CASE
  1317. WHEN w.f_dc = 'D' THEN
  1318. '收'
  1319. WHEN w.f_dc = 'C' THEN
  1320. '付'
  1321. END AS fSrcdcName,
  1322. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  1323. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
  1324. dict.dict_label AS fFeeunitid,
  1325. w.f_qty AS fQty,
  1326. w.f_unitprice AS fUnitprice,
  1327. w.f_business_type AS fBusinessType,
  1328. w.remark AS fRemarks
  1329. FROM
  1330. t_warehousebillsfees w
  1331. LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
  1332. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  1333. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1334. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  1335. <where>
  1336. dict.status = '0'
  1337. AND dict.dict_type = 'data_unitfees'
  1338. <if test="map.tWareHouseFees.stlTypeid != null">and w.f_stltypeid = #{map.tWareHouseFees.stlTypeid}</if>
  1339. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
  1340. #{map.tWareHouseFees.fCorpid}
  1341. </if>
  1342. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  1343. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  1344. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  1345. #{map.tWareHouseFees.fToCorpid}
  1346. </if>
  1347. <if test="map.tWareHouseFees.fBillno != null and map.tWareHouseFees.fBillno != ''">and t.f_billno like
  1348. concat('%', #{map.tWareHouseFees.fBillno}, '%')
  1349. </if>
  1350. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  1351. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  1352. </if>
  1353. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  1354. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  1355. </if>
  1356. <if test="map.tWareHouseFees.fProductName != null and map.tWareHouseFees.fProductName != ''">
  1357. and w.f_product_name like concat('%', #{map.tWareHouseFees.fProductName}, '%')
  1358. </if>
  1359. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  1360. and w.f_accamount_date IS NOT NULL
  1361. </if>
  1362. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  1363. and w.f_accamount_date IS NULL
  1364. </if>
  1365. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  1366. and w.f_dc = #{map.tWareHouseFees.fDc}
  1367. </if>
  1368. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  1369. and w.f_dc = #{map.tWareHouseFees.fDc}
  1370. </if>
  1371. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  1372. and w.f_feeid in
  1373. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  1374. separator=",">
  1375. #{id}
  1376. </foreach>
  1377. </if>
  1378. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  1379. and w.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  1380. </if>
  1381. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  1382. and w.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  1383. </if>
  1384. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  1385. and w.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  1386. </if>
  1387. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  1388. and w.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  1389. </if>
  1390. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  1391. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  1392. </if>
  1393. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  1394. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  1395. </if>
  1396. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
  1397. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1398. </if>
  1399. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
  1400. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1401. </if>
  1402. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
  1403. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1404. </if>
  1405. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
  1406. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1407. </if>
  1408. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  1409. and w.f_business_type in
  1410. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  1411. #{id}
  1412. </foreach>
  1413. </if>
  1414. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  1415. and w.f_id in
  1416. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  1417. separator=",">
  1418. #{id}
  1419. </foreach>
  1420. </if>
  1421. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  1422. and t.f_id in
  1423. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  1424. separator=",">
  1425. #{id}
  1426. </foreach>
  1427. </if>
  1428. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  1429. </if>
  1430. <if test='map.tWareHouseFees.createBy != null and map.tWareHouseFees.createBy != ""'>
  1431. and w.create_by = #{map.tWareHouseFees.createBy}
  1432. </if>
  1433. and w.f_review_date IS NOT NULL
  1434. and abs(IFNULL(w.f_amount, 0) - IFNULL(w.f_accamount, 0)) &gt; 0
  1435. GROUP BY w.f_id
  1436. </where>
  1437. </select>
  1438. <!--
  1439. <select id="warehouseBillsFeesListAccamount" resultType="java.util.Map">
  1440. SELECT
  1441. w.f_id AS fSrcid,
  1442. t.f_id AS fSrcpid,
  1443. t.f_corpid AS fCorpid,
  1444. c.f_name AS fName,
  1445. w.fName AS fFeesName,
  1446. t.f_bscorpno AS fBscorpno,
  1447. w.f_mblno AS fMblno,
  1448. w.f_product_name AS fProductName,
  1449. w.f_bsdate AS fBsdate,
  1450. t.f_billtype AS fBilltype,
  1451. t.f_review_date AS fReviewDate,
  1452. w.f_marks AS fMarks,
  1453. w.f_feeid AS fFeeid,
  1454. w.f_billtype AS fBilltype,
  1455. w.f_chargedate AS fChargedate,
  1456. w.f_originalbilldate AS fOriginalbilldate,
  1457. w.f_billing_deadline AS fBillingDeadline,
  1458. w.f_billing_days AS fBillingDays,
  1459. w.f_inventory_days AS fInventoryDays,
  1460. f.f_name AS fFeeName,
  1461. w.f_dc AS fSrcdc,
  1462. CASE
  1463. WHEN w.f_dc = 'D' THEN '收'
  1464. WHEN w.f_dc = 'C' THEN '付'
  1465. END AS fSrcdcName,
  1466. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  1467. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
  1468. dict.dict_label AS fFeeunitid,
  1469. w.f_qty AS fQty ,
  1470. w.f_unitprice AS fUnitprice ,
  1471. dictIn.dict_label AS fBusinessType
  1472. FROM
  1473. t_warehousebills t
  1474. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1475. LEFT JOIN (
  1476. SELECT
  1477. f.f_id AS f_id,
  1478. f.f_pid AS f_pid,
  1479. f.f_lineno AS f_lineno,
  1480. f.f_corpid,
  1481. f.f_feeid,
  1482. f.f_feeUnitid,
  1483. f.f_qty,
  1484. f.f_unitprice,
  1485. f.f_amount,
  1486. f.f_currency,
  1487. f.f_exrate,
  1488. f.f_taxrate,
  1489. f.f_dc,
  1490. f.f_billstatus,
  1491. f.f_statement_no,
  1492. f.f_accamount,
  1493. f.f_accamount_date,
  1494. f.f_stlamount_no,
  1495. f.f_stlamount,
  1496. f.f_stlamount_date,
  1497. f.f_invnos,
  1498. f.f_invamount,
  1499. f.f_askamount,
  1500. f.f_status,
  1501. f.remark,
  1502. f.f_inventory_days,
  1503. f.f_billing_days,
  1504. f.f_billing_deadline,
  1505. f.f_originalbilldate,
  1506. f.f_mblno,
  1507. f.f_product_name,
  1508. f.f_chargedate,
  1509. f.src_bill_no,
  1510. f.f_billtype,
  1511. f.f_marks,
  1512. f.f_business_type,
  1513. f.f_bsdate,
  1514. c.f_id AS fId,
  1515. c.f_name AS fName
  1516. FROM
  1517. t_warehousebillsfees AS f
  1518. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  1519. ) w ON w.f_pid = t.f_id
  1520. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1521. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  1522. LEFT JOIN sys_dict_data dictIn ON dictIn.dict_value = w.f_business_type
  1523. <where>
  1524. dict.status = '0'
  1525. AND dict.dict_type = 'data_unitfees'
  1526. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  1527. #{map.tWareHouseFees.fCorpid}
  1528. </if>
  1529. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  1530. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  1531. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  1532. #{map.tWareHouseFees.fToCorpid}
  1533. </if>
  1534. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  1535. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  1536. </if>
  1537. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  1538. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  1539. </if>
  1540. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  1541. and w.f_accamount_date IS NOT NULL
  1542. </if>
  1543. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  1544. and w.f_accamount_date IS NULL
  1545. </if>
  1546. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  1547. and w.f_dc = #{map.tWareHouseFees.fDc}
  1548. </if>
  1549. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  1550. and w.f_dc = #{map.tWareHouseFees.fDc}
  1551. </if>
  1552. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  1553. and w.f_feeid in
  1554. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  1555. separator=",">
  1556. #{id}
  1557. </foreach>
  1558. </if>
  1559. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  1560. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  1561. </if>
  1562. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  1563. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  1564. </if>
  1565. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  1566. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  1567. </if>
  1568. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  1569. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  1570. </if>
  1571. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  1572. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  1573. </if>
  1574. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  1575. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  1576. </if>
  1577. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
  1578. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1579. AND dictIn.dict_type = 'st_in_type'
  1580. AND dictIn.status = '0'
  1581. </if>
  1582. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
  1583. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1584. AND dictIn.dict_type = 'st_out_type'
  1585. AND dictIn.status = '0'
  1586. </if>
  1587. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
  1588. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1589. AND dictIn.dict_type = 'st_trans_type'
  1590. AND dictIn.status = '0'
  1591. </if>
  1592. <if test="map.tWareHouseFees.fBilltype == null ">
  1593. AND dictIn.dict_type in ('st_in_type','st_out_type','st_trans_type')
  1594. AND dictIn.status = '0'
  1595. </if>
  1596. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
  1597. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  1598. </if>
  1599. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  1600. and w.f_business_type in
  1601. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  1602. #{id}
  1603. </foreach>
  1604. </if>
  1605. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  1606. and w.f_id in
  1607. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  1608. separator=",">
  1609. #{id}
  1610. </foreach>
  1611. </if>
  1612. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  1613. and t.f_id in
  1614. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  1615. separator=",">
  1616. #{id}
  1617. </foreach>
  1618. </if>
  1619. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  1620. </if>
  1621. <if test='map.tWareHouseFees.createBy != null and map.tWareHouseFees.createBy != ""'>
  1622. and t.create_by = #{map.tWareHouseFees.createBy}
  1623. </if>
  1624. and t.f_review_date IS NOT NULL
  1625. and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
  1626. GROUP BY w.f_id
  1627. </where>
  1628. </select>
  1629. -->
  1630. <select id="warehouseBillsKHFeesListAccamount" resultType="java.util.Map">
  1631. SELECT
  1632. w.f_id AS fSrcid,
  1633. t.f_id AS fSrcpid,
  1634. t.f_corpid AS fCorpid,
  1635. t.f_billno fBillno,
  1636. c.f_name AS fName,
  1637. w.fName AS fFeesName,
  1638. t.f_bscorpno AS fBscorpno,
  1639. w.f_mblno AS fMblno,
  1640. w.f_product_name AS fProductName,
  1641. w.f_bsdate AS fBsdate,
  1642. t.f_billtype AS tfBilltype,
  1643. t.f_review_date AS fReviewDate,
  1644. w.f_marks AS fMarks,
  1645. w.f_feeid AS fFeeid,
  1646. w.f_billtype AS wfBilltype,
  1647. w.f_chargedate AS fChargedate,
  1648. w.f_originalbilldate AS fOriginalbilldate,
  1649. w.f_billing_deadline AS fBillingDeadline,
  1650. w.f_billing_days AS fBillingDays,
  1651. w.f_inventory_days AS fInventoryDays,
  1652. f.f_name AS fFeeName,
  1653. w.f_dc AS fSrcdc,
  1654. CASE
  1655. WHEN w.f_dc = 'D' THEN '收'
  1656. WHEN w.f_dc = 'C' THEN '付'
  1657. END AS fSrcdcName,
  1658. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  1659. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
  1660. dict.dict_label AS fFeeunitid,
  1661. w.f_qty AS fQty,
  1662. w.f_unitprice AS fUnitprice,
  1663. w.f_currency AS fCurreny,
  1664. w.f_taxrate AS fTaxrate,
  1665. w.remark AS remark,
  1666. tv.f_name AS boatName,
  1667. ty.f_no AS voyageName,
  1668. w.create_time createTime,
  1669. w.businessName
  1670. FROM
  1671. t_warehousebills t
  1672. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1673. LEFT JOIN (
  1674. SELECT
  1675. f.f_id AS f_id,
  1676. f.f_pid AS f_pid,
  1677. f.f_lineno AS f_lineno,
  1678. f.f_corpid,
  1679. f.f_feeid,
  1680. f.f_feeUnitid,
  1681. f.f_qty,
  1682. f.f_unitprice,
  1683. f.f_amount,
  1684. f.f_currency,
  1685. f.f_exrate,
  1686. f.f_taxrate,
  1687. f.f_dc,
  1688. f.f_billstatus,
  1689. f.f_statement_no,
  1690. f.f_accamount,
  1691. f.f_accamount_date,
  1692. f.f_stlamount_no,
  1693. f.f_stlamount,
  1694. f.f_stlamount_date,
  1695. f.f_invnos,
  1696. f.f_invamount,
  1697. f.f_askamount,
  1698. f.f_status,
  1699. f.remark,
  1700. f.f_inventory_days,
  1701. f.f_billing_days,
  1702. f.f_billing_deadline,
  1703. f.f_originalbilldate,
  1704. f.f_mblno,
  1705. f.f_product_name,
  1706. f.f_chargedate,
  1707. f.src_bill_no,
  1708. f.f_billtype,
  1709. f.f_marks,
  1710. f.f_business_type,
  1711. pro.dict_label businessName,
  1712. f.f_bsdate,
  1713. c.f_id AS fId,
  1714. c.f_name AS fName,
  1715. f.create_time
  1716. FROM
  1717. t_warehousebillsfees AS f
  1718. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  1719. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.f_business_type and pro.dict_type = 'data_billType'
  1720. ) w ON w.f_pid = t.f_id
  1721. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1722. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  1723. LEFT JOIN t_vessel tv ON tv.f_id = t.f_vslid
  1724. LEFT JOIN t_voyage ty ON ty.f_id = t.f_voyid
  1725. <where>
  1726. dict.status = '0'
  1727. AND dict.dict_type = 'data_unitfees'
  1728. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
  1729. #{map.tWareHouseFees.fToCorpid}
  1730. </if>
  1731. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  1732. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  1733. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  1734. #{map.tWareHouseFees.fCorpid}
  1735. </if>
  1736. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  1737. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  1738. </if>
  1739. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  1740. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  1741. </if>
  1742. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  1743. and w.f_accamount_date IS NOT NULL
  1744. </if>
  1745. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  1746. and w.f_accamount_date IS NULL
  1747. </if>
  1748. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  1749. and w.f_dc = #{map.tWareHouseFees.fDc}
  1750. </if>
  1751. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  1752. and w.f_dc = #{map.tWareHouseFees.fDc}
  1753. </if>
  1754. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  1755. and w.f_feeid in
  1756. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  1757. separator=",">
  1758. #{id}
  1759. </foreach>
  1760. </if>
  1761. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  1762. and t.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  1763. </if>
  1764. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  1765. and t.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  1766. </if>
  1767. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
  1768. and w.create_time &gt;= #{map.tWareHouseFees.createTimeList[0]}
  1769. </if>
  1770. <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
  1771. and w.create_time &lt;= #{map.tWareHouseFees.createTimeList[1]}
  1772. </if>
  1773. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  1774. and t.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  1775. </if>
  1776. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  1777. and t.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  1778. </if>
  1779. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  1780. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  1781. </if>
  1782. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  1783. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  1784. </if>
  1785. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  1786. and w.f_business_type in
  1787. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  1788. #{id}
  1789. </foreach>
  1790. </if>
  1791. <if test="map.tWareHouseFees.fVslid != null">and tv.f_vslid = #{map.tWareHouseFees.fVslid}</if>
  1792. <if test="map.tWareHouseFees.fVoyid != null">and ty.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
  1793. <if test="map.tWareHouseFees.boatName != null and map.tWareHouseFees.boatName != ''">and tv.f_name =
  1794. #{map.tWareHouseFees.boatName}
  1795. </if>
  1796. <if test="map.tWareHouseFees.voyageName != null and map.tWareHouseFees.voyageName != ''">and ty.f_no =
  1797. #{map.tWareHouseFees.voyageName}
  1798. </if>
  1799. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  1800. </if>
  1801. and t.f_review_date IS NOT NULL
  1802. and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
  1803. GROUP BY w.f_id
  1804. </where>
  1805. </select>
  1806. <select id="warehouseBillsFeesList1" resultType="java.util.Map">
  1807. SELECT
  1808. w.f_id AS fSrcid,
  1809. t.f_id AS fSrcpid,
  1810. t.f_corpid AS fCorpid,
  1811. c.f_name AS fName,
  1812. w.f_corpid AS fCorpids,
  1813. c1.f_name AS fFeesName,
  1814. w.f_mblno AS fMblno,
  1815. w.f_product_name AS fProductName,
  1816. w.f_marks AS fMarks,
  1817. t.f_billtype AS fBilltype,
  1818. t.f_review_date AS fReviewDate,
  1819. w.f_dc AS fSrcdc,
  1820. SUM(w.f_amount) AS fAmount,
  1821. SUM(w.f_stlamount) AS fStlamount,
  1822. ifnull(SUM( w.f_amount ) , 0 ) - ifnull( SUM( w.f_stlamount ) , 0 ) AS nnfinished
  1823. FROM
  1824. t_warehousebills t
  1825. left join sys_user u on t.create_by = u.user_name
  1826. left join sys_dept d on t.f_bsdeptid = d.dept_id
  1827. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1828. LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
  1829. LEFT JOIN t_corps c1 ON w.f_corpid = c1.f_id
  1830. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  1831. <where>
  1832. <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
  1833. <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
  1834. <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
  1835. <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
  1836. <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',
  1837. #{fProductName}, '%')
  1838. </if>
  1839. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
  1840. and w.f_billstatus != 6
  1841. </if>
  1842. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  1843. and w.f_billstatus = 6
  1844. </if>
  1845. <if test='fDc != null and fDc != "" and fDc == "D" '>
  1846. and w.f_dc = #{fDc}
  1847. </if>
  1848. <if test='fDc != null and fDc != "" and fDc == "C" '>
  1849. and w.f_dc = #{fDc}
  1850. </if>
  1851. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  1852. and t.f_review_date &gt;= #{timeExamine[0]}
  1853. </if>
  1854. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  1855. and t.f_review_date &lt;= #{timeExamine[1]}
  1856. </if>
  1857. <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
  1858. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
  1859. </if>
  1860. and w.f_review_date IS NOT NULL
  1861. ${params.dataScope}
  1862. GROUP BY
  1863. w.f_pid,
  1864. w.f_dc,
  1865. w.f_corpid
  1866. </where>
  1867. </select>
  1868. <select id="selectTWarehousebillsItemsList"
  1869. resultType="com.ruoyi.warehouseBusiness.excel.TWareHouseExcelItem">
  1870. SELECT (@ii := @ii + 1) AS fId,
  1871. wi.f_mblno AS fMblno,
  1872. wi.f_bsdate AS fBsdate,
  1873. f.f_name AS fFeeid,
  1874. CASE
  1875. WHEN w.f_srcdc = 'D' THEN
  1876. '收'
  1877. WHEN w.f_srcdc = 'C' THEN
  1878. '付'
  1879. END AS fSrcdc,
  1880. w.f_amtdr AS fAmtdr,
  1881. dict.dict_label AS fFeeunitid,
  1882. wi.f_qty AS fBillingQty,
  1883. wi.f_unitprice AS fUnitprice,
  1884. w.f_amt AS fAmt,
  1885. w.f_src_billno AS fSrcBillno,
  1886. wi.f_business_type AS fBusinessType,
  1887. CASE
  1888. wi.f_billtype
  1889. WHEN 'SJRK' THEN
  1890. '入库'
  1891. WHEN 'SJCK' THEN
  1892. '出库'
  1893. WHEN 'HQZY' THEN
  1894. '货转'
  1895. WHEN 'CKDB' THEN
  1896. '调拨'
  1897. WHEN 'HWTG' THEN
  1898. '货物通关'
  1899. WHEN 'KCZZ' THEN
  1900. '库存总账'
  1901. END AS fBilltype,
  1902. wi.f_product_name AS fGoodsid,
  1903. wi.f_marks AS fMarks,
  1904. wi.f_chargedate AS fChargedate,
  1905. wi.f_billing_deadline AS fBillingDeadline,
  1906. wi.f_inventory_days AS fInventoryDays,
  1907. wi.f_billing_days AS fBillingDays,
  1908. w.f_remarks AS fRemarks
  1909. FROM t_fee_do w
  1910. LEFT JOIN t_warehousebillsfees wi ON w.f_srcid = wi.f_id
  1911. LEFT JOIN t_fees f ON wi.f_feeid = f.f_id
  1912. LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_feeUnitid
  1913. , (
  1914. SELECT @ii := 0
  1915. ) AS ii
  1916. WHERE dict.status = '0'
  1917. AND dict.dict_type = 'data_unitfees'
  1918. AND w.f_pid = #{fId}
  1919. </select>
  1920. <select id="warehouseBillsFeesProfitList" resultType="java.util.Map">
  1921. SELECT
  1922. t.f_id AS fSrcpid,
  1923. c.f_name AS fName,
  1924. c1.f_name AS fFeesName,
  1925. w.f_mblno AS fMblno,
  1926. w.f_product_name AS fProductName,
  1927. u1.user_name AS fSalesmanName,
  1928. w.f_marks AS fMarks,
  1929. t.f_billtype AS fBilltype,
  1930. w.f_review_date AS fReviewDate,
  1931. sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) fAmount,
  1932. sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) fStlamount,
  1933. sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) - sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END )
  1934. nnfinished
  1935. FROM
  1936. t_warehousebillsfees w
  1937. LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
  1938. left join sys_user u on t.create_by = u.user_name
  1939. left join sys_user u1 on t.f_salesman_id = u1.user_id
  1940. left join sys_dept d on t.f_bsdeptid = d.dept_id
  1941. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  1942. LEFT JOIN t_corps c1 ON c1.f_id = w.f_corpid
  1943. <where>
  1944. <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
  1945. <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
  1946. <if test="fDeptId != null and fDeptId != ''">and t.f_bsdeptid = #{fDeptId}</if>
  1947. <if test="fSalesmanId != null and fSalesmanId != ''">and t.f_salesman_id = #{fSalesmanId}</if>
  1948. <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
  1949. <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
  1950. <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',
  1951. #{fProductName}, '%')
  1952. </if>
  1953. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
  1954. and w.f_billstatus != 6
  1955. </if>
  1956. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  1957. and w.f_billstatus = 6
  1958. </if>
  1959. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  1960. and w.f_review_date &gt;= #{timeExamine[0]}
  1961. </if>
  1962. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  1963. and w.f_review_date &lt;= #{timeExamine[1]}
  1964. </if>
  1965. <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
  1966. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
  1967. </if>
  1968. <if test="fBusinessType != null and fBusinessType != '' ">
  1969. and w.f_business_type in
  1970. <foreach collection="fBusinessType" item="id" open="(" close=")" separator=",">
  1971. #{id}
  1972. </foreach>
  1973. </if>
  1974. <if test="fFeeid != null and fFeeid != '' ">
  1975. and w.f_feeid in
  1976. <foreach collection="fFeeid" item="id" open="(" close=")" separator=",">
  1977. #{id}
  1978. </foreach>
  1979. </if>
  1980. and w.f_review_date IS NOT NULL
  1981. ${params.dataScope}
  1982. GROUP BY
  1983. w.f_mblno
  1984. </where>
  1985. </select>
  1986. <select id="warehouseBillsFeesCustomProfitList" resultType="java.util.Map">
  1987. SELECT distinct
  1988. c.f_name AS fName,
  1989. c.f_id AS fCorpid,
  1990. DATE_FORMAT(w.f_review_date,'%Y-%m') AS reviewDate,
  1991. DATE_FORMAT(w.f_bsdate,'%Y-%m') AS f_bstime,
  1992. sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) fAmount,
  1993. sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) fStlamount,
  1994. sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) - sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) nnfinished
  1995. FROM
  1996. t_warehousebillsfees w
  1997. LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
  1998. left join sys_user u on t.create_by = u.user_name
  1999. left join sys_user u1 on t.f_salesman_id = u1.user_id
  2000. left join sys_dept d on t.f_bsdeptid = d.dept_id
  2001. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  2002. LEFT JOIN t_corps c1 ON c1.f_id = w.f_corpid
  2003. <where>
  2004. <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
  2005. <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
  2006. <if test="fDeptId != null and fDeptId != ''">and t.f_bsdeptid = #{fDeptId}</if>
  2007. <if test="fSalesmanId != null and fSalesmanId != ''">and t.f_salesman_id = #{fSalesmanId}</if>
  2008. <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
  2009. <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
  2010. <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',#{fProductName}, '%')</if>
  2011. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>and w.f_billstatus != 6</if>
  2012. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>and w.f_billstatus = 6</if>
  2013. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  2014. and DATE_FORMAT(w.f_review_date, '%Y-%m') between #{timeExamine[0]} and #{timeExamine[1]}
  2015. </if>
  2016. <if test="fBstimeExamine != null and fBstimeExamine[0] != null and fBstimeExamine[0]!= ''">
  2017. and DATE_FORMAT(w.f_bsdate, '%Y-%m') between #{fBstimeExamine[0]} and #{fBstimeExamine[1]}
  2018. </if>
  2019. <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
  2020. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
  2021. </if>
  2022. <if test="fBusinessType != null and fBusinessType != '' ">
  2023. and w.f_business_type in
  2024. <foreach collection="fBusinessType" item="id" open="(" close=")" separator=",">
  2025. #{id}
  2026. </foreach>
  2027. </if>
  2028. <if test="fFeeid != null and fFeeid != '' ">
  2029. and w.f_feeid in
  2030. <foreach collection="fFeeid" item="id" open="(" close=")" separator=",">
  2031. #{id}
  2032. </foreach>
  2033. </if>
  2034. and w.f_review_date IS NOT NULL
  2035. ${params.dataScope}
  2036. </where>
  2037. GROUP BY
  2038. c.f_name,
  2039. reviewDate
  2040. </select>
  2041. <select id="selectFeeList" resultType="java.util.Map">
  2042. select
  2043. ware.create_by AS createBy,
  2044. ware.f_billno AS fBillno,
  2045. ware.f_ctrlcorpid AS fCtrlcorpid,
  2046. ware.create_time AS createTime,
  2047. ware.f_accbilldate AS fAccbilldate,
  2048. ware.t_mblno AS tMblno,
  2049. dic.dict_label AS chargingMethod,
  2050. ware.invoice_no AS invoiceNo,
  2051. ware.bank AS bank,
  2052. ware.water_bill_no AS waterBillNo,
  2053. ware.f_amtdr AS fAmtdr,
  2054. ware.f_amtcr AS fAmtcr,
  2055. ware.f_remarks AS fRemarks,
  2056. CASE
  2057. WHEN ware.f_billstatus = '1' THEN '新建'
  2058. WHEN ware.f_billstatus = '2' THEN '暂存'
  2059. WHEN ware.f_billstatus = '3' THEN '审批驳回'
  2060. WHEN ware.f_billstatus = '4' THEN '提交审核'
  2061. WHEN ware.f_billstatus = '5' THEN '审核中'
  2062. WHEN ware.f_billstatus = '6' THEN '审核完成'
  2063. END
  2064. AS fBillstatus
  2065. from
  2066. t_fee ware
  2067. left join sys_user u on ware.create_by = u.user_name
  2068. left join sys_dept d on ware.f_deptid = d.dept_id
  2069. LEFT JOIN (
  2070. SELECT *
  2071. FROM sys_dict_data dic
  2072. WHERE
  2073. dic.dict_label =
  2074. IF(
  2075. (dic.`status`='0' AND dic.dict_type = 'data_settlement_type')
  2076. ,dic.dict_label,NULL)
  2077. ) dic ON dic.dict_value = ware.charging_method
  2078. <where>
  2079. <if test="fBillno != null and fBillno != ''">and ware.f_billno = #{fBillno}</if>
  2080. <if test="fCtrlcorpid != null ">and ware.f_ctrlcorpid = #{fCtrlcorpid}</if>
  2081. <if test="fActId != null ">and ware.f_act_id = #{fActId}</if>
  2082. <if test="fCorpid != null ">and ware.f_corpid = #{fCorpid}</if>
  2083. <if test="fTransActId != null ">and ware.f_trans_act_id = #{fTransActId}</if>
  2084. <if test="tMblno != null and tMblno != ''">and ware.t_mblno = #{tMblno}</if>
  2085. <if test="fAmtdr != null ">and ware.f_amtdr = #{fAmtdr}</if>
  2086. <if test="fAmtcr != null ">and ware.f_amtcr = #{fAmtcr}</if>
  2087. <if test="fBilltype != null and fBilltype != ''">and ware.f_billtype = #{fBilltype}</if>
  2088. <if test="fBillstatus != null and fBillstatus != ''">and ware.f_billstatus = #{fBillstatus}</if>
  2089. <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks = #{fRemarks}</if>
  2090. <if test="fFromDate != null ">and ware.f_from_date = #{fFromDate}</if>
  2091. <if test="fAccbilldate != null ">and ware.f_accbilldate = #{fAccbilldate}</if>
  2092. <if test="fToDate != null ">and ware.f_to_date = #{fToDate}</if>
  2093. <if test="fRefNo != null and fRefNo != ''">and ware.f_ref_no = #{fRefNo}</if>
  2094. <if test="fDeptid != null ">and ware.f_deptid = #{fDeptid}</if>
  2095. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  2096. and ware.f_accbilldate &gt;= #{timeInterval[0]}
  2097. </if>
  2098. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  2099. and ware.f_accbilldate &lt;= #{timeInterval[1]}
  2100. </if>
  2101. <if test="chargingMethod != null ">and ware.charging_method = #{chargingMethod}</if>
  2102. <if test="invoiceNo != null ">and ware.invoice_no = #{invoiceNo}</if>
  2103. <if test="bank != null ">and ware.bank = #{bank}</if>
  2104. <if test="waterBillNo != null ">and ware.water_bill_no = #{waterBillNo}</if>
  2105. </where>
  2106. ${params.dataScope}
  2107. </select>
  2108. <select id="selectDetailedList" resultType="com.ruoyi.finance.excel.Detailed">
  2109. SELECT (@ii := @ii + 1) AS fId,
  2110. wi.f_mblno AS fMblno,
  2111. wi.f_bsdate AS fBsdate,
  2112. t.f_bscorpno AS fBscorpno,
  2113. f.f_name AS fFeeid,
  2114. CASE
  2115. WHEN w.f_srcdc = 'D' THEN
  2116. '收'
  2117. WHEN w.f_srcdc = 'C' THEN
  2118. '付'
  2119. END AS fSrcdc,
  2120. w.f_amtdr AS fAmtdr,
  2121. dict.dict_label AS fFeeunitid,
  2122. wi.f_qty AS fBillingQty,
  2123. wi.f_unitprice AS fUnitprice,
  2124. w.f_amt AS fAmt,
  2125. wi.f_business_type AS fBusinessType,
  2126. CASE
  2127. wi.f_billtype
  2128. WHEN 'SJRK' THEN
  2129. '入库'
  2130. WHEN 'SJCK' THEN
  2131. '出库'
  2132. WHEN 'HQZY' THEN
  2133. '货转'
  2134. WHEN 'CKDB' THEN
  2135. '调拨'
  2136. WHEN 'HWTG' THEN
  2137. '货物通关'
  2138. WHEN 'KCZZ' THEN
  2139. '库存总账'
  2140. END AS fBilltype,
  2141. wi.f_product_name AS fGoodsid,
  2142. wi.f_marks AS fMarks,
  2143. w.f_remarks AS fRemarks
  2144. FROM t_fee_do w
  2145. LEFT JOIN t_warehousebillsfees wi ON w.f_srcid = wi.f_id
  2146. LEFT JOIN t_warehousebills t ON wi.f_pid = t.f_id
  2147. LEFT JOIN t_fees f ON wi.f_feeid = f.f_id
  2148. LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_feeUnitid
  2149. , (
  2150. SELECT @ii := 0
  2151. ) AS ii
  2152. WHERE dict.status = '0'
  2153. AND dict.dict_type = 'data_unitfees'
  2154. AND w.f_pid = #{fId}
  2155. </select>
  2156. <select id="selectDetailedList1" resultType="java.util.Map">
  2157. SELECT t.f_id AS fSrcpid,
  2158. t.f_corpid AS fCorpid,
  2159. c.f_name AS fName,
  2160. c1.f_name AS fFeesName,
  2161. w.f_mblno AS fMblno,
  2162. w.f_product_name AS fProductName,
  2163. w.f_marks AS fMarks,
  2164. w.f_dc AS fSrcdc,
  2165. w.f_amount AS fAmount,
  2166. w.f_stlamount AS fStlamount,
  2167. ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) AS nnfinished
  2168. FROM t_warehousebills t
  2169. LEFT JOIN sys_user u ON t.create_by = u.user_name
  2170. LEFT JOIN sys_dept d ON t.f_bsdeptid = d.dept_id
  2171. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  2172. LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
  2173. LEFT JOIN t_corps c1 ON w.f_corpid = c1.f_id
  2174. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  2175. WHERE w.f_dc = #{fSrcdc}
  2176. AND t.f_review_date IS NOT NULL
  2177. AND w.f_corpid = #{fCorpIds}
  2178. AND t.f_corpid = #{fCorpId}
  2179. AND w.f_mblno = #{fMblno}
  2180. </select>
  2181. <!--网页版发票申请查询-->
  2182. <select id="webVersionInvoice" parameterType="TFee" resultType="java.util.Map">
  2183. SELECT
  2184. tf.f_id AS fId,/**费用主表id*/
  2185. tf.f_billno AS fBillno,/**费用申请编号*/
  2186. tf.f_ctrlcorpid AS fCtrlcorpid,/**货权方*/
  2187. tf.f_corpid AS fCorpid,/**结算单位*/
  2188. tc.f_name AS fCorpidName,/**结算单位中文名称*/
  2189. tf.t_mblno AS tMblno,/**提单号*/
  2190. tf.f_amtdr AS fAmtdr,/**应收合计*/
  2191. tf.f_amtcr AS fAmtcr,/**应付合计*/
  2192. tf.f_billtype AS fBilltype,/**业务类型*/
  2193. tf.f_billstatus AS fBillstatus,/**状态*/
  2194. CASE
  2195. WHEN tf.f_billstatus = '1' THEN
  2196. '新建'
  2197. WHEN tf.f_billstatus = '2' THEN
  2198. '暂存'
  2199. WHEN tf.f_billstatus = '3' THEN
  2200. '驳回'
  2201. WHEN tf.f_billstatus = '4' THEN
  2202. '提交'
  2203. WHEN tf.f_billstatus = '5' THEN
  2204. '审批中'
  2205. WHEN tf.f_billstatus = '6' THEN
  2206. '审批通过'
  2207. END AS fBillstatusName,
  2208. tf.f_remarks AS fRemarks,/**备注*/
  2209. tf.f_accbilldate AS fAccbilldate,/**结算日期*/
  2210. tf.create_by AS createBy,/**创建人*/
  2211. tf.create_time AS createTime,/**创建时间*/
  2212. tf.update_by AS updateBy,/**更新人*/
  2213. tf.update_time AS updateTime,/**更新时间*/
  2214. tf.invoice_no AS invoiceNo,/**发票号*/
  2215. tf.bank AS bank,/**银行*/
  2216. tf.water_bill_no AS waterBillNo,/**水单号*/
  2217. tf.f_system_type AS fSystemType,/**系统类型*/
  2218. tf.f_tracking_number AS fTrackingNumber,/**快递单号*/
  2219. tf.f_invoice_rise AS fInvoiceRise,/**发票抬头*/
  2220. tf.f_sign AS fSign,/**是否签收*/
  2221. tf.f_send_Time AS fSendTime,/**寄送时间*/
  2222. tf.charging_method AS chargingMethod,/**收费方式*/
  2223. pro.dict_label AS chargingMethodName /**收费方式中文名称*/
  2224. FROM
  2225. t_fee tf
  2226. LEFT JOIN t_corps tc ON tf.f_corpid = tc.f_id
  2227. LEFT JOIN sys_dict_data pro ON pro.dict_value = tf.charging_method
  2228. AND pro.dict_type = 'data_settlement_type'
  2229. WHERE tf.f_billtype = 'ApplyFP'
  2230. <if test="createBy != null and createBy != ''">and tf.create_by = #{createBy}</if>
  2231. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  2232. and tf.create_time &gt;= #{timeInterval[0]}
  2233. </if>
  2234. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  2235. and tf.create_time &lt;= #{timeInterval[1]}
  2236. </if>
  2237. <if test="invoiceNo != null and invoiceNo != ''">and tf.invoice_no like concat('%', #{invoiceNo}, '%')</if>
  2238. <if test="fInvoiceRise != null and fInvoiceRise != ''">and tf.f_invoice_rise like concat('%', #{fInvoiceRise},
  2239. '%')
  2240. </if>
  2241. <if test="fBillno != null and fBillno != ''">and tf.f_billno like concat('%', #{fBillno}, '%')</if>
  2242. <if test="fBillstatus != null and fBillstatus != '' and fBillstatus != 'null' ">and tf.f_billstatus =
  2243. #{fBillstatus}
  2244. </if>
  2245. ORDER BY tf.f_id desc
  2246. </select>
  2247. <!--凯和检索费用信息-->
  2248. <select id="FinancialFeesList" resultType="java.util.Map">
  2249. SELECT
  2250. w.f_id AS fSrcid,
  2251. t.f_id AS fSrcpid,
  2252. w.f_corpid AS fCorpid,
  2253. w.fName AS fName,
  2254. t.f_mblno AS fMblno,
  2255. w.f_bsdate AS fBsdate,
  2256. t.f_billtype AS fBilltype,
  2257. t.f_review_date AS fReviewDate,
  2258. w.f_feeid AS fFeeid,
  2259. w.src_bill_no AS srcBillNo,
  2260. w.f_marks AS fMarks,
  2261. f.f_name AS fFeeName,
  2262. w.f_dc AS fSrcdc,
  2263. w.f_qty AS fQty,
  2264. w.f_unitprice AS fUnitPrice,
  2265. w.f_amount AS fAmount,
  2266. w.f_feeUnitid AS fFeeUnitId,
  2267. pr.dict_label AS fFeeUnitName,
  2268. t.f_vslid AS fVslid,
  2269. t.f_voyid AS fVoyid,
  2270. tv.f_name AS fvslName,
  2271. ty.f_no AS fvoyName,
  2272. tre.f_name AS fLoadPortName,
  2273. ts.f_name As fDestPortName,
  2274. w.f_billstatus AS fBillStatus,
  2275. t.f_loadportid AS fLoadportid,
  2276. t.f_destportid AS fDestportid,
  2277. tn.f_name AS cntrName,
  2278. ti.f_cntrcount AS fCntrCount,
  2279. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHDZ" '>
  2280. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
  2281. ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
  2282. </if>
  2283. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHSF" '>
  2284. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
  2285. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
  2286. </if>
  2287. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHFF" '>
  2288. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
  2289. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
  2290. </if>
  2291. CASE
  2292. WHEN w.f_dc = 'D' THEN '收'
  2293. WHEN w.f_dc = 'C' THEN '付'
  2294. END AS fSrcdcName,
  2295. CASE
  2296. WHEN w.f_billstatus = '1' THEN '新建'
  2297. WHEN w.f_billstatus = '2' THEN '暂存'
  2298. WHEN w.f_billstatus = '3' THEN '驳回'
  2299. WHEN w.f_billstatus = '4' THEN '提交'
  2300. WHEN w.f_billstatus = '5' THEN '审批中'
  2301. WHEN w.f_billstatus = '6' THEN '通过'
  2302. END AS fBillStatusName,
  2303. tg.f_name AS goodName
  2304. FROM
  2305. t_warehousebills t
  2306. LEFT JOIN (
  2307. SELECT
  2308. f.f_id AS f_id,
  2309. f.f_pid AS f_pid,
  2310. f.f_lineno AS f_lineno,
  2311. f.f_corpid,
  2312. f.f_feeid,
  2313. f.f_feeUnitid,
  2314. f.f_qty,
  2315. f.f_unitprice,
  2316. f.f_amount,
  2317. f.f_currency,
  2318. f.f_exrate,
  2319. f.f_taxrate,
  2320. f.f_dc,
  2321. f.f_billstatus,
  2322. f.f_statement_no,
  2323. f.f_accamount,
  2324. f.f_accamount_date,
  2325. f.f_stlamount_no,
  2326. f.f_stlamount,
  2327. f.f_stlamount_date,
  2328. f.f_invnos,
  2329. f.f_invamount,
  2330. f.f_askamount,
  2331. f.f_chargedate,
  2332. f.f_status,
  2333. f.remark,
  2334. f.f_mblno,
  2335. f.f_product_name,
  2336. f.src_bill_no,
  2337. f.f_billing_days,
  2338. f.f_inventory_days,
  2339. f.f_marks,
  2340. f.f_billing_deadline,
  2341. f.f_originalbilldate,
  2342. f.f_billtype,
  2343. f.f_business_type,
  2344. f.f_bsdate,
  2345. c.f_id AS fId,
  2346. c.f_name AS fName
  2347. FROM
  2348. t_warehousebillsfees AS f
  2349. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  2350. ) w ON w.f_pid = t.f_id
  2351. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  2352. LEFT JOIN sys_dict_data pr ON pr.dict_value = w.f_feeUnitid
  2353. AND pr.dict_type = 'data_unitfees'
  2354. LEFT JOIN t_vessel tv ON t.f_vslid = tv.f_id
  2355. LEFT JOIN t_voyage ty ON t.f_voyid = ty.f_id
  2356. LEFT JOIN t_address tre ON tre.f_id = t.f_loadportid
  2357. LEFT JOIN t_address ts ON ts.f_id = t.f_destportid
  2358. LEFT JOIN t_warehousebills_cntr ti ON ti.f_pid = t.f_id
  2359. LEFT JOIN t_cntr tn ON tn.f_id = ti.f_cntrid
  2360. LEFT JOIN t_goods tg ON ti.f_goodsid = tg.f_id
  2361. <where>
  2362. t.f_typeid = 1
  2363. and w.f_billstatus = 6
  2364. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
  2365. #{map.tWareHouseFees.fCorpid}
  2366. </if>
  2367. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  2368. and w.f_accamount_date IS NOT NULL
  2369. </if>
  2370. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  2371. and w.f_accamount_date IS NULL
  2372. </if>
  2373. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and t.f_mblno like
  2374. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  2375. </if>
  2376. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != ""'>
  2377. and w.f_dc = #{map.tWareHouseFees.fDc}
  2378. </if>
  2379. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  2380. w.f_statement_no = #{map.tWareHouseFees.fStatementNo}
  2381. </if>
  2382. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  2383. </if>
  2384. <if test="map.tWareHouseFees.fVslid != null">and t.f_vslid = #{map.tWareHouseFees.fVslid}</if>
  2385. <if test="map.tWareHouseFees.fVoyid != null">and t.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
  2386. <if test="map.tWareHouseFees.fLoadportid != null ">and t.f_loadportid = #{map.tWareHouseFees.fLoadportid}
  2387. </if>
  2388. <if test="map.tWareHouseFees.fDestportid != null ">and t.f_destportid = #{map.tWareHouseFees.fDestportid}
  2389. </if>
  2390. <if test="map.tWareHouseFees.fFromDate != null ">and ty.f_ATD &gt;= #{map.tWareHouseFees.fFromDate}</if>
  2391. <if test="map.tWareHouseFees.fToDate != null ">and ty.f_ATD &lt;= #{map.tWareHouseFees.fToDate}</if>
  2392. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHDZ" '>
  2393. and abs(ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0)) > 0
  2394. </if>
  2395. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHSF" '>
  2396. and abs(ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0)) > 0
  2397. </if>
  2398. <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHFF" '>
  2399. and abs(ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0)) > 0
  2400. </if>
  2401. GROUP BY w.f_id
  2402. </where>
  2403. </select>
  2404. <!--凯和查询财务主表数据-->
  2405. <select id="selectFinancialTFeeId" parameterType="TFee" resultType="com.ruoyi.finance.shipping.FinancialTFee">
  2406. SELECT
  2407. f.f_id AS fId,
  2408. f.f_billno AS fBillno,
  2409. f.f_ctrlcorpid AS fCtrlcorpid,
  2410. pro.dict_label AS chargingMethod,
  2411. f.invoice_no AS invoiceNo,
  2412. f.bank AS fBank,
  2413. f.water_bill_no AS waterBillNo,
  2414. f.f_corpid AS fCorpid,
  2415. c.f_name AS fCorpidName,
  2416. f.f_accbilldate AS fAccbilldate,
  2417. f.t_mblno AS tMblno,
  2418. f.f_amtdr AS fAmtdr,
  2419. f.f_amtcr AS fAmtcr,
  2420. f.f_billtype AS fBilltype,
  2421. f.f_system_type AS fSystemType,
  2422. f.f_billstatus AS fBillstatus,
  2423. CASE
  2424. WHEN f.f_billstatus = '1' THEN '新建'
  2425. WHEN f.f_billstatus = '2' THEN '暂存'
  2426. WHEN f.f_billstatus = '3' THEN '审批驳回'
  2427. WHEN f.f_billstatus = '4' THEN '提交审核'
  2428. WHEN f.f_billstatus = '5' THEN '审核中'
  2429. WHEN f.f_billstatus = '6' THEN '审核完成'
  2430. END
  2431. AS fBillstatusName,
  2432. f.f_remarks AS fRemarks,
  2433. f.create_by AS createBy,
  2434. f.create_time AS createTime,
  2435. f.update_by AS updateBy,
  2436. f.update_time AS updateTime,
  2437. tv.f_name AS vessel,
  2438. ty.f_no AS voyage,
  2439. tre.f_name AS loadportName,
  2440. ts.f_name AS destportName,
  2441. f.f_bank_number AS fBankNumber,
  2442. f.bank AS bank,
  2443. f.invoice_remarks AS invoiceRemarks,
  2444. f.f_loadportid AS fLoadportid,
  2445. f.f_destportid AS fDestportid,
  2446. f.f_billno AS srcBillNo,
  2447. CASE
  2448. WHEN f.f_dc = 'D' THEN
  2449. '收'
  2450. WHEN f.f_dc = 'C' THEN
  2451. '付'
  2452. END AS fSrcdcName,
  2453. f.f_vslid AS fVslid,
  2454. f.f_voyid AS fVoyid,
  2455. f.f_from_date AS fFromDate,
  2456. f.f_to_date AS fToDate,
  2457. f.f_reconciliation AS fReconciliation,
  2458. f.f_dc AS fDc
  2459. FROM
  2460. t_fee AS f
  2461. LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
  2462. LEFT JOIN sys_dict_data pro ON pro.dict_value = f.charging_method and pro.dict_type = 'data_settlement_type'
  2463. LEFT JOIN t_vessel tv ON f.f_vslid = tv.f_id
  2464. LEFT JOIN t_voyage ty ON f.f_voyid = ty.f_id
  2465. LEFT JOIN t_address tre ON tre.f_id = f.f_loadportid
  2466. LEFT JOIN t_address ts ON ts.f_id = f.f_destportid
  2467. where
  2468. f.f_id = #{fId}
  2469. </select>
  2470. <select id="exportFinancial" parameterType="TFee" resultType="com.ruoyi.shipping.excel.ExportFinancial">
  2471. SELECT
  2472. @rank:=@rank + 1 AS rankNo,
  2473. tp.fMblNo AS fMblNo,
  2474. tp.portOfDeparture AS portOfDeparture,
  2475. tp.destinationPort AS destinationPort,
  2476. tp.goodName AS goodName,
  2477. IFNULL(tp.fCnTrCount,0) AS fCnTrCount,
  2478. tp.specification AS specification,
  2479. ROUND(IFNULL(tp.fUnitPrice,0),2) AS fUnitPrice,
  2480. ROUND(IFNULL(tp.fAmount,0),2) AS fAmount,
  2481. tp.fServiceitems AS fServiceitems,
  2482. tp.fServiceitemsNew AS fServiceitemsNew
  2483. FROM
  2484. (
  2485. SELECT
  2486. tw.f_mblno AS fMblNo,
  2487. ts.f_name AS portOfDeparture,
  2488. ty.f_name AS destinationPort,
  2489. tg.f_name AS goodName,
  2490. IFNULL(temp.fCnTrCount,0) AS fCnTrCount,
  2491. tr.f_name AS specification,
  2492. CASE
  2493. WHEN temp.fCnTrCount != 0 THEN temp.fAmount/temp.fCnTrCount
  2494. ELSE 0
  2495. END AS fUnitPrice,
  2496. IFNULL(temp.fAmount,0) AS fAmount,
  2497. sd.dict_label fServiceitems,
  2498. si.dict_label fServiceitemsNew
  2499. FROM
  2500. (
  2501. SELECT
  2502. td.f_srcpid AS pId,
  2503. IFNULL(tr.f_cntrcount,0) AS fCnTrCount,
  2504. IFNULL(SUM(td.f_amt),0) AS fAmount
  2505. FROM
  2506. t_fee_do td
  2507. LEFT JOIN
  2508. t_warehousebills tw ON tw.f_id = td.f_srcpid
  2509. LEFT JOIN t_warehousebills_cntr tr ON tr.f_pid = tw.f_id
  2510. WHERE td.f_pid = #{id}
  2511. GROUP BY td.f_srcpid
  2512. )temp
  2513. LEFT JOIN t_warehousebills tw ON tw.f_id = temp.pId
  2514. LEFT JOIN t_address ts ON tw.f_loadportid = ts.f_id
  2515. LEFT JOIN t_address ty ON tw.f_destportid = ty.f_id
  2516. LEFT JOIN t_warehousebills_cntr tc ON tc.f_pid = tw.f_id
  2517. LEFT JOIN t_cntr tr ON tr.f_id = tc.f_cntrid
  2518. LEFT JOIN t_goods tg ON tc.f_goodsid = tg.f_id
  2519. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems AND sd.dict_type = 'f_serviceitems'
  2520. LEFT JOIN sys_dict_data si ON si.dict_value = tw.f_serviceitems_new AND si.dict_type = 'f_serviceitemsNew'
  2521. )tp,
  2522. (SELECT @rank:= 0) b
  2523. </select>
  2524. <select id="receivable" resultType="com.ruoyi.finance.shipping.ReceivableExcel">
  2525. SELECT
  2526. DISTINCT
  2527. tv.f_name AS shipsName,#船名
  2528. ty.f_no AS voyage,# 航次
  2529. tc.f_name AS unitOfAccount,#结算单位
  2530. tw.f_mblno AS blNo,#提单号
  2531. ta.f_name AS portOfLoading,#起运港
  2532. td.f_name AS destination,#目的港
  2533. ty.f_ATD sailingDate,#开船日期
  2534. tf.f_review_date AS auditDate,#审核日期
  2535. ROUND(IFNULL(SUM(f_amount),0),2) AS receivable, #应收金额
  2536. ROUND(IFNULL(SUM(f_stlamount),0),2) AS handle,#实收金额
  2537. ROUND((IFNULL(SUM(f_amount),0)-IFNULL(SUM(f_stlamount),0)),2) AS profit #未收金额
  2538. FROM
  2539. t_warehousebillsfees tf
  2540. LEFT JOIN t_warehousebills tw ON tf.f_pid = tw.f_id
  2541. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  2542. LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
  2543. LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
  2544. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  2545. LEFT JOIN t_address td ON td.f_id = tw.f_destportid
  2546. <where>
  2547. tf.f_dc = #{fDc}
  2548. and tw.f_typeid = 1
  2549. and tw.del_flag = '0'
  2550. <if test="fMblno != null and fMblno != ''">and tw.f_mblno like concat('%', #{fMblno}, '%')</if>
  2551. <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
  2552. <if test="fCorpid != null">and tf.f_corpid = #{fCorpid}</if>
  2553. <if test="fVoyid != null">and tw.f_voyid = #{fVoyid}</if>
  2554. <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
  2555. <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
  2556. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  2557. and tf.f_billstatus != 6
  2558. </if>
  2559. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "2" '>
  2560. and tf.f_billstatus = 6
  2561. </if>
  2562. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  2563. and tf.f_review_date &gt;= #{timeExamine[0]}
  2564. </if>
  2565. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  2566. and tf.f_review_date &lt;= #{timeExamine[1]}
  2567. </if>
  2568. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  2569. and ty.f_ATD &gt;= #{timeInterval[0]}
  2570. </if>
  2571. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  2572. and ty.f_ATD &lt;= #{timeInterval[1]}
  2573. </if>
  2574. GROUP BY tw.f_mblno,tf.f_corpid
  2575. ORDER BY tw.f_bsdate DESC
  2576. </where>
  2577. </select>
  2578. <select id="profit" resultType="com.ruoyi.finance.shipping.ProfitExcel">
  2579. SELECT
  2580. DISTINCT
  2581. tv.f_name AS shipsName,
  2582. ty.f_no AS voyage,
  2583. ty.f_atd AS atd,
  2584. ROUND(sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ),2) AS receivable,
  2585. ROUND(sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ),2) AS handle,
  2586. ROUND((sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) - sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END )),2) AS profit,
  2587. ROUND(sum( CASE f_dc WHEN 'D' THEN f_stlamount ELSE 0 END ),2) AS actualReceivable,
  2588. ROUND(sum( CASE f_dc WHEN 'C' THEN f_stlamount ELSE 0 END ),2) AS actualHandle
  2589. FROM
  2590. t_warehousebillsfees tf
  2591. LEFT JOIN t_warehousebills tw ON tf.f_pid = tw.f_id
  2592. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  2593. LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
  2594. <where>
  2595. tw.f_typeid in (1, 10)
  2596. and tw.del_flag = '0'
  2597. <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
  2598. <if test="fVoyid != null">and tw.f_voyid = #{fVoyid}</if>
  2599. <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
  2600. <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
  2601. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  2602. and tf.f_billstatus != 6
  2603. </if>
  2604. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "2" '>
  2605. and tf.f_billstatus = 6
  2606. </if>
  2607. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  2608. and tf.f_review_date &gt;= #{timeExamine[0]}
  2609. </if>
  2610. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  2611. and tf.f_review_date &lt;= #{timeExamine[1]}
  2612. </if>
  2613. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  2614. and ty.f_ATD &gt;= #{timeInterval[0]}
  2615. </if>
  2616. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  2617. and ty.f_ATD &lt;= #{timeInterval[1]}
  2618. </if>
  2619. GROUP BY tw.f_vslid,tw.f_voyid,ty.f_atd
  2620. ORDER BY ty.f_atd DESC
  2621. </where>
  2622. </select>
  2623. <select id="handle" resultType="com.ruoyi.finance.shipping.HandleExcel">
  2624. SELECT
  2625. DISTINCT
  2626. tv.f_name AS shipsName,#船名
  2627. ty.f_no AS voyage,# 航次
  2628. tc.f_name AS unitOfAccount,#结算单位
  2629. tw.f_mblno AS blNo,#提单号
  2630. ta.f_name AS portOfLoading,#起运港
  2631. td.f_name AS destination,#目的港
  2632. ty.f_ATD sailingDate,#开船日期
  2633. tf.f_review_date AS auditDate,#审核日期
  2634. ROUND(IFNULL(SUM(f_amount),0),2) AS receivable, #应收金额
  2635. ROUND(IFNULL(SUM(f_stlamount),0),2) AS handle,#实收金额
  2636. ROUND((IFNULL(SUM(f_amount),0)-IFNULL(SUM(f_stlamount),0)),2) AS profit #未收金额
  2637. FROM
  2638. t_warehousebillsfees tf
  2639. LEFT JOIN t_warehousebills tw ON tf.f_pid = tw.f_id
  2640. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  2641. LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
  2642. LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
  2643. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  2644. LEFT JOIN t_address td ON td.f_id = tw.f_destportid
  2645. <where>
  2646. tf.f_dc = #{fDc}
  2647. and tw.f_typeid = 1
  2648. and tw.del_flag = '0'
  2649. <if test="fMblno != null and fMblno != ''">and tw.f_mblno like concat('%', #{fMblno}, '%')</if>
  2650. <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
  2651. <if test="fCorpid != null">and tf.f_corpid = #{fCorpid}</if>
  2652. <if test="fVoyid != null">and tw.f_voyid = #{fVoyid}</if>
  2653. <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
  2654. <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
  2655. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
  2656. and tf.f_billstatus != 6
  2657. </if>
  2658. <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "2" '>
  2659. and tf.f_billstatus = 6
  2660. </if>
  2661. <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
  2662. and tf.f_review_date &gt;= #{timeExamine[0]}
  2663. </if>
  2664. <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
  2665. and tf.f_review_date &lt;= #{timeExamine[1]}
  2666. </if>
  2667. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  2668. and ty.f_ATD &gt;= #{timeInterval[0]}
  2669. </if>
  2670. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  2671. and ty.f_ATD &lt;= #{timeInterval[1]}
  2672. </if>
  2673. GROUP BY tw.f_mblno,tf.f_corpid
  2674. ORDER BY tw.f_bsdate DESC
  2675. </where>
  2676. </select>
  2677. <select id="queryApplyInvoiceFeesList" resultType="java.util.Map">
  2678. SELECT
  2679. w.f_id AS fSrcid,
  2680. t.f_id AS fSrcpid,
  2681. t.f_corpid AS fCorpid,
  2682. c.f_name AS fName,
  2683. c.f_name AS fFeesName,
  2684. t.f_bscorpno AS fBscorpno,
  2685. t.f_billno as fBillno,
  2686. w.f_mblno AS fMblno,
  2687. w.f_product_name AS fProductName,
  2688. w.f_bsdate AS fBsdate,
  2689. t.f_billtype AS fBilltype,
  2690. t.f_review_date AS fReviewDate,
  2691. w.f_marks AS fMarks,
  2692. w.f_feeid AS fFeeid,
  2693. w.f_billtype AS fBilltype,
  2694. w.f_chargedate AS fChargedate,
  2695. w.f_originalbilldate AS fOriginalbilldate,
  2696. w.f_billing_deadline AS fBillingDeadline,
  2697. w.f_billing_days AS fBillingDays,
  2698. w.f_inventory_days AS fInventoryDays,
  2699. f.f_name AS fFeeName,
  2700. w.f_dc AS fSrcdc,
  2701. CASE
  2702. WHEN w.f_dc = 'D' THEN
  2703. '收'
  2704. WHEN w.f_dc = 'C' THEN
  2705. '付'
  2706. END AS fSrcdcName,
  2707. ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmtdr,
  2708. ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmt,
  2709. dict.dict_label AS fFeeunitid,
  2710. w.f_qty AS fQty,
  2711. w.f_unitprice AS fUnitprice,
  2712. w.f_business_type AS fBusinessType,
  2713. w.remark AS fRemarks
  2714. FROM
  2715. t_warehousebillsfees w
  2716. LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
  2717. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  2718. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  2719. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
  2720. <where>
  2721. dict.status = '0'
  2722. AND dict.dict_type = 'data_unitfees'
  2723. <if test="map.tWareHouseFees.stlTypeid != null">and w.f_stltypeid = #{map.tWareHouseFees.stlTypeid}</if>
  2724. <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
  2725. #{map.tWareHouseFees.fCorpid}
  2726. </if>
  2727. <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
  2728. <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
  2729. <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
  2730. #{map.tWareHouseFees.fToCorpid}
  2731. </if>
  2732. <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
  2733. concat('%', #{map.tWareHouseFees.fMblno}, '%')
  2734. </if>
  2735. <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
  2736. w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
  2737. </if>
  2738. <if test="map.tWareHouseFees.fProductName != null and map.tWareHouseFees.fProductName != ''">
  2739. and w.f_product_name like concat('%', #{map.tWareHouseFees.fProductName}, '%')
  2740. </if>
  2741. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
  2742. and w.f_accamount_date IS NOT NULL
  2743. </if>
  2744. <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
  2745. and w.f_accamount_date IS NULL
  2746. </if>
  2747. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
  2748. and w.f_dc = #{map.tWareHouseFees.fDc}
  2749. </if>
  2750. <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
  2751. and w.f_dc = #{map.tWareHouseFees.fDc}
  2752. </if>
  2753. <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
  2754. and w.f_feeid in
  2755. <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
  2756. separator=",">
  2757. #{id}
  2758. </foreach>
  2759. </if>
  2760. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
  2761. and w.f_review_date &gt;= #{map.tWareHouseFees.timeExamine[0]}
  2762. </if>
  2763. <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
  2764. and w.f_review_date &lt;= #{map.tWareHouseFees.timeExamine[1]}
  2765. </if>
  2766. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
  2767. and w.f_bsdate &gt;= #{map.tWareHouseFees.timeInterval[0]}
  2768. </if>
  2769. <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
  2770. and w.f_bsdate &lt;= #{map.tWareHouseFees.timeInterval[1]}
  2771. </if>
  2772. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
  2773. and w.f_accamount_date &gt;= #{map.tWareHouseFees.timeReconci[0]}
  2774. </if>
  2775. <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
  2776. and w.f_accamount_date &lt;= #{map.tWareHouseFees.timeReconci[1]}
  2777. </if>
  2778. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
  2779. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  2780. </if>
  2781. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
  2782. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  2783. </if>
  2784. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
  2785. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  2786. </if>
  2787. <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
  2788. and w.f_billtype = #{map.tWareHouseFees.fBilltype}
  2789. </if>
  2790. <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
  2791. and w.f_business_type in
  2792. <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
  2793. #{id}
  2794. </foreach>
  2795. </if>
  2796. <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
  2797. and w.f_id in
  2798. <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
  2799. separator=",">
  2800. #{id}
  2801. </foreach>
  2802. </if>
  2803. <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
  2804. and t.f_id in
  2805. <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
  2806. separator=",">
  2807. #{id}
  2808. </foreach>
  2809. </if>
  2810. <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
  2811. </if>
  2812. <if test='map.tWareHouseFees.createBy != null and map.tWareHouseFees.createBy != ""'>
  2813. and w.create_by = #{map.tWareHouseFees.createBy}
  2814. </if>
  2815. and w.f_review_date IS NOT NULL
  2816. and abs(IFNULL(w.f_amount, 0) - IFNULL(w.f_invamount, 0)) &gt; 0
  2817. GROUP BY w.f_id
  2818. </where>
  2819. </select>
  2820. <select id="selectFinancialLedgerList" resultMap="feeVOResult">
  2821. SELECT
  2822. c.f_name AS f_fees_name, w.f_corpid, w.f_mblno, w.f_billstatus, DATE_FORMAT(w.f_review_date,'%Y-%m') AS reviewDate,DATE_FORMAT(w.f_bsdate,'%Y-%m') AS bstime,
  2823. SUM( w.f_amount ) AS f_amount, SUM( w.f_stlamount ) AS f_stlamount,SUM( w.f_accamount ) AS f_accamount,SUM( w.f_invamount ) AS f_invamount,
  2824. ifnull( SUM( w.f_amount ), 0 ) - ifnull( SUM( w.f_stlamount ), 0 ) AS nnfinished
  2825. FROM
  2826. t_warehousebills t
  2827. LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
  2828. LEFT JOIN sys_user u ON t.create_by = u.user_name
  2829. LEFT JOIN sys_dept d ON t.f_bsdeptid = d.dept_id
  2830. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  2831. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  2832. <where>
  2833. t.del_flag = '0'
  2834. and w.f_dc = #{fDc}
  2835. <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
  2836. <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
  2837. <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
  2838. <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
  2839. <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',
  2840. #{fProductName}, '%')
  2841. </if>
  2842. <if test="isReviewed != null and isReviewed == 0">
  2843. and w.f_billstatus != 6
  2844. </if>
  2845. <if test="isReviewed != null and isReviewed == 1">
  2846. and w.f_billstatus = 6
  2847. </if>
  2848. <if test="fReconciliation!= null and fReconciliation != '' and fReconciliation == 0">
  2849. and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
  2850. </if>
  2851. <if test="timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ''">
  2852. and DATE_FORMAT(w.f_review_date, '%Y-%m') between #{timeExamine[0]} and #{timeExamine[1]}
  2853. </if>
  2854. <if test="fBstimeExamine != null and fBstimeExamine[0] != null and fBstimeExamine[0]!= ''">
  2855. and DATE_FORMAT(w.f_bsdate, '%Y-%m') between #{fBstimeExamine[0]} and #{fBstimeExamine[1]}
  2856. </if>
  2857. ${params.dataScope}
  2858. </where>
  2859. GROUP BY
  2860. w.f_corpid,
  2861. w.f_dc,
  2862. reviewDate
  2863. </select>
  2864. <select id="selectFinancialLedgerDetails" resultMap="feeVOResult">
  2865. SELECT t.f_id AS f_srcpid,
  2866. CASE
  2867. WHEN w.f_dc = 'D' THEN c.f_name
  2868. WHEN w.f_dc = 'C' THEN c1.f_name
  2869. END
  2870. AS f_fees_name,
  2871. c.f_name AS corpName,
  2872. w.f_mblno AS f_mblno,w.f_product_name, w.f_marks, t.f_billtype,
  2873. CASE
  2874. WHEN t.f_billtype = 'SJRK' THEN '实际入库'
  2875. WHEN t.f_billtype = 'SJCK' THEN '实际出库'
  2876. WHEN t.f_billtype = 'JSCCF' THEN '仓储费'
  2877. WHEN t.f_billtype = 'KCZZ' THEN '库存总账'
  2878. END
  2879. AS fBillTypeName,
  2880. w.f_review_date,w.f_accamount,w.f_invamount,
  2881. IF ( w.f_feeid = #{feesId}, w.f_amount, 0.00 ) storage_fee,
  2882. IF ( w.f_feeid != #{feesId}, w.f_amount, 0.00 ) other_fee,
  2883. w.f_amount, w.f_stlamount AS fStlamount,
  2884. ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS nnfinished,
  2885. w.f_bsdate AS fBstime,
  2886. w.f_dc,
  2887. w.f_unitprice,
  2888. w.f_qty,
  2889. w.f_inventory_days,
  2890. f.f_name
  2891. FROM t_warehousebills t
  2892. LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
  2893. LEFT JOIN sys_user u ON t.create_by = u.user_name
  2894. LEFT JOIN sys_dept d ON t.f_bsdeptid = d.dept_id
  2895. LEFT JOIN t_corps c ON c.f_id = t.f_corpid
  2896. LEFT JOIN t_corps c1 ON c1.f_id = w.f_corpid
  2897. LEFT JOIN t_fees f ON w.f_feeid = f.f_id
  2898. where
  2899. t.del_flag = '0'
  2900. <if test="fDc != null and fDc != ''">and w.f_dc = #{fDc}</if>
  2901. <if test="fCorpId != null and fCorpId != ''">and w.f_corpid = #{fCorpId}</if>
  2902. <if test="fToCorpid != null and fToCorpid != ''">and t.f_corpid = #{fToCorpid}</if>
  2903. <if test='isReviewed != null and isReviewed == 0 '>
  2904. and w.f_billstatus != 6
  2905. </if>
  2906. <if test='isReviewed != null and isReviewed == 1 '>
  2907. and w.f_billstatus = 6
  2908. </if>
  2909. <if test='fAuditList != null and fAuditList[0] != null'>
  2910. and DATE_FORMAT(w.f_bsdate, '%Y-%m') BETWEEN #{fAuditList[0]} and #{fAuditList[1]}
  2911. </if>
  2912. <if test="fBstimeExamine != null and fBstimeExamine[0] != null and fBstimeExamine[0]!= ''">
  2913. and DATE_FORMAT(w.f_review_date, '%Y-%m') between #{fBstimeExamine[0]} and #{fBstimeExamine[1]}
  2914. </if>
  2915. GROUP BY
  2916. w.f_id
  2917. </select>
  2918. </mapper>