TFeeMapper.xml 119 KB

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