TFeeMapper.xml 126 KB

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