TFeeMapper.xml 141 KB

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