12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ruoyi.finance.mapper.TFeeMapper">
- <resultMap type="TFee" id="TFeeResult">
- <result property="fId" column="f_id"/>
- <result property="fBillno" column="f_billno"/>
- <result property="fCtrlcorpid" column="f_ctrlcorpid"/>
- <result property="fActId" column="f_act_id"/>
- <result property="fCorpid" column="f_corpid"/>
- <result property="tMblno" column="t_mblno"/>
- <result property="fTransActId" column="f_trans_act_id"/>
- <result property="fAmtdr" column="f_amtdr"/>
- <result property="fAmtcr" column="f_amtcr"/>
- <result property="fBilltype" column="f_billtype"/>
- <result property="fBillstatus" column="f_billstatus"/>
- <result property="fRemarks" column="f_remarks"/>
- <result property="fFromDate" column="f_from_date"/>
- <result property="fToDate" column="f_to_date"/>
- <result property="fAccbilldate" column="f_accbilldate"/>
- <result property="fRefNo" column="f_ref_no"/>
- <result property="delFlag" column="del_flag"/>
- <result property="createBy" column="create_by"/>
- <result property="fDeptid" column="f_deptid"/>
- <result property="createTime" column="create_time"/>
- <result property="updateBy" column="update_by"/>
- <result property="updateTime" column="update_time"/>
- <result property="chargingMethod" column="charging_method"/>
- <result property="fTotalamount" column="f_totalamount"/>
- <result property="invoiceNo" column="invoice_no"/>
- <result property="bank" column="bank"/>
- <result property="waterBillNo" column="water_bill_no"/>
- <result property="fSystemType" column="f_system_type"/>
- <result property="fTrackingNumber" column="f_tracking_number"/>
- <result property="fInvoiceRise" column="f_invoice_rise"/>
- <result property="fSign" column="f_sign"/>
- <result property="fSendTime" column="f_send_Time"/>
- <result property="fApplyMoney" column="f_apply_money"/>
- <result property="fAccountId" column="f_account_id"/>
- <result property="fMake" column="f_make"/>
- <result property="fVslid" column="f_vslid"/>
- <result property="fVoyid" column="f_voyid"/>
- <result property="fLoadportid" column="f_loadportid"/>
- <result property="fDestportid" column="f_destportid"/>
- <result property="fDc" column="f_dc"/>
- <result property="fBankNumber" column="f_bank_number"/>
- <result property="fReconciliation" column="f_reconciliation"/>
- <result property="invoiceRemarks" column="invoice_remarks"/>
- </resultMap>
- <resultMap type="FeeVO" id="feeVOResult">
- <result property="fId" column="f_id"/>
- <result property="fBillno" column="f_billno"/>
- <result property="fCtrlcorpid" column="f_ctrlcorpid"/>
- <result property="fActId" column="f_act_id"/>
- <result property="fCorpid" column="f_corpid"/>
- <result property="tMblno" column="t_mblno"/>
- <result property="fTransActId" column="f_trans_act_id"/>
- <result property="fAmtdr" column="f_amtdr"/>
- <result property="fAmtcr" column="f_amtcr"/>
- <result property="fBilltype" column="f_billtype"/>
- <result property="fBillstatus" column="f_billstatus"/>
- <result property="fRemarks" column="f_remarks"/>
- <result property="fFromDate" column="f_from_date"/>
- <result property="fToDate" column="f_to_date"/>
- <result property="fAccbilldate" column="f_accbilldate"/>
- <result property="fRefNo" column="f_ref_no"/>
- <result property="delFlag" column="del_flag"/>
- <result property="createBy" column="create_by"/>
- <result property="fDeptid" column="f_deptid"/>
- <result property="createTime" column="create_time"/>
- <result property="updateBy" column="update_by"/>
- <result property="updateTime" column="update_time"/>
- <result property="chargingMethod" column="charging_method"/>
- <result property="fTotalamount" column="f_totalamount"/>
- <result property="fSrcBillno" column="f_src_billno"/>
- <result property="invoiceNo" column="invoice_no"/>
- <result property="bank" column="bank"/>
- <result property="waterBillNo" column="water_bill_no"/>
- <result property="fSystemType" column="f_system_type"/>
- <result property="fTrackingNumber" column="f_tracking_number"/>
- <result property="fInvoiceRise" column="f_invoice_rise"/>
- <result property="fSign" column="f_sign"/>
- <result property="fSendTime" column="f_send_Time"/>
- <result property="fApplyMoney" column="f_apply_money"/>
- <result property="fAccountId" column="f_account_id"/>
- <result property="fMake" column="f_make"/>
- <result property="fVslid" column="f_vslid"/>
- <result property="fVoyid" column="f_voyid"/>
- <result property="fLoadportid" column="f_loadportid"/>
- <result property="fDestportid" column="f_destportid"/>
- <result property="fDc" column="f_dc"/>
- <result property="fBankNumber" column="f_bank_number"/>
- <result property="fReconciliation" column="f_reconciliation"/>
- <result property="invoiceRemarks" column="invoice_remarks"/>
- <result property="invoiceRemarks" column="invoice_remarks"/>
- <result property="fFeesName" column="f_fees_name"/>
- <result property="fAmount" column="f_amount"/>
- <result property="fStlamount" column="f_stlamount"/>
- <result property="storageFee" column="storage_fee"/>
- <result property="otherFee" column="other_fee"/>
- <result property="fSrcpid" column="f_srcpid"/>
- <result property="fMblno" column="f_mblno"/>
- <result property="fMarks" column="f_marks"/>
- <result property="fProductName" column="f_product_name"/>
- <result property="fReviewDate" column="f_review_date"/>
- <result property="fAccamount" column="f_accamount"/>
- <result property="fInvamount" column="f_invamount"/>
- </resultMap>
- <sql id="selectTFeeVo">
- select f_id,
- f_billno,
- f_ctrlcorpid,
- f_act_id,
- f_corpid,
- t_mblno,
- f_trans_act_id,
- f_amtdr,
- f_amtcr,
- f_billtype,
- f_billstatus,
- f_remarks,
- f_from_date,
- f_to_date,
- f_accbilldate,
- f_ref_no,
- del_flag,
- create_by,
- f_deptid,
- create_time,
- update_by,
- update_time,
- charging_method,
- f_totalamount,
- invoice_no,
- bank,
- water_bill_no,
- f_system_type,
- f_tracking_number,
- f_invoice_rise,
- f_sign,
- f_send_Time,
- f_apply_money,
- f_account_id,
- f_make,
- f_vslid,
- f_voyid,
- f_loadportid,
- f_destportid,
- f_dc,
- f_bank_number,
- f_reconciliation,
- invoice_remarks
- from t_fee
- </sql>
- <select id="selectTFeeList" parameterType="TFee" resultMap="TFeeResult">
- select
- ware.f_id,
- ware.f_billno,
- ware.f_ctrlcorpid,
- ware.f_act_id,
- ware.f_corpid,
- ware.t_mblno,
- ware.f_trans_act_id,
- ware.f_amtdr,
- ware.f_amtcr,
- ware.f_billtype,
- CASE
- WHEN ware.f_billstatus = '1' THEN '新建'
- WHEN ware.f_billstatus = '2' THEN '暂存'
- WHEN ware.f_billstatus = '3' THEN '审批驳回'
- WHEN ware.f_billstatus = '4' THEN '提交审核'
- WHEN ware.f_billstatus = '5' THEN '审核中'
- WHEN ware.f_billstatus = '6' THEN '审核完成'
- END
- AS f_billstatus,
- ware.f_remarks,
- ware.f_from_date,
- ware.f_to_date,
- ware.f_accbilldate,
- ware.f_ref_no,
- ware.del_flag,
- ware.create_by,
- ware.f_deptid,
- ware.create_time,
- ware.update_by,
- ware.update_time,
- pro.dict_label AS charging_method,
- ware.f_totalamount AS f_totalamount,
- ware.invoice_no,
- ware.bank,
- ware.water_bill_no,
- ware.f_system_type,
- ware.f_apply_money as fApplyMoney
- from
- t_fee ware
- left join sys_user u on ware.create_by = u.user_name
- left join sys_dept d on ware.f_deptid = d.dept_id
- LEFT JOIN sys_dict_data pro ON pro.dict_value = ware.charging_method and pro.dict_type = 'data_settlement_type'
- <where>
- <if test="fBillno != null and fBillno != ''">and ware.f_billno like concat('%', #{ fBillno}, '%') </if>
- <if test="fCtrlcorpid != null ">and ware.f_ctrlcorpid = #{fCtrlcorpid}</if>
- <if test="fActId != null ">and ware.f_act_id = #{fActId}</if>
- <if test="fCorpid != null ">and ware.f_corpid = #{fCorpid}</if>
- <if test="fTransActId != null ">and ware.f_trans_act_id = #{fTransActId}</if>
- <if test="tMblno != null and tMblno != ''">and t_mblno = #{tMblno}</if>
- <if test="fAmtdr != null ">and ware.f_amtdr = #{fAmtdr}</if>
- <if test="fAmtcr != null ">and ware.f_amtcr = #{fAmtcr}</if>
- <if test="fBilltype != null and fBilltype != ''">and ware.f_billtype = #{fBilltype}</if>
- <if test="fBillstatus != null and fBillstatus != ''">and ware.f_billstatus = #{fBillstatus}</if>
- <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%')</if>
- <if test="fFromDate != null ">and ware.f_from_date = #{fFromDate}</if>
- <if test="fAccbilldate != null ">and ware.f_accbilldate = #{fAccbilldate}</if>
- <if test="fToDate != null ">and ware.f_to_date = #{fToDate}</if>
- <if test="fRefNo != null and fRefNo != ''">and ware.f_ref_no = #{fRefNo}</if>
- <if test="fDeptid != null ">and ware.f_deptid = #{fDeptid}</if>
- <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
- and ware.f_accbilldate >= #{timeInterval[0]}
- </if>
- <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
- and ware.f_accbilldate <= #{timeInterval[1]}
- </if>
- <if test='amount != null and amount[0] != null and amount[0]!= ""'>
- and ware.f_amtdr >= #{amount[0]}
- </if>
- <if test='amount != null and amount[1] != null and amount[1]!= ""'>
- and ware.f_amtdr <= #{amount[1]}
- </if>
- <if test="chargingMethod != null ">and ware.charging_method = #{chargingMethod}</if>
- <if test="fTotalamount != null ">and ware.f_totalamount = #{fTotalamount}</if>
- <if test="invoiceNo != null ">and ware.invoice_no = #{invoiceNo}</if>
- <if test="bank != null ">and ware.bank = #{bank}</if>
- <if test="waterBillNo != null ">and ware.water_bill_no = #{waterBillNo}</if>
- <if test="fSystemType != null and fSystemType != ''">and ware.f_system_type = #{fSystemType}</if>
- </where>
- ${params.dataScope}
- ORDER BY ware.f_id desc
- </select>
- <select id="selectTFeeList1" parameterType="TFee" resultType="Map">
- SELECT
- f.f_id AS fId,
- f.f_billno AS fBillno,
- fd.f_src_billno AS fSrcBillno,
- f.f_ctrlcorpid AS fCtrlcorpid,
- pro.dict_label AS chargingMethod,
- f.invoice_no AS invoiceNo,
- f.bank,
- f.water_bill_no AS waterBillNo,
- f.f_corpid AS fCorpid,
- c.f_name AS fCorpidName,
- f.f_accbilldate AS fAccbilldate,
- f.t_mblno AS tMblno,
- SUM(fd.f_amtdr) AS fAmtdr,
- SUM(fd.f_amt) AS fAmtcr,
- f.f_billtype AS fBilltype,
- f.f_system_type AS fSystemType,
- CASE
- WHEN f.f_billstatus = '1' THEN '新建'
- WHEN f.f_billstatus = '2' THEN '暂存'
- WHEN f.f_billstatus = '3' THEN '审批驳回'
- WHEN f.f_billstatus = '4' THEN '提交审核'
- WHEN f.f_billstatus = '5' THEN '审核中'
- WHEN f.f_billstatus = '6' THEN '审核完成'
- END
- AS fBillstatus,
- f.f_remarks AS fRemarks,
- f.create_by AS createBy,
- tp.f_name AS createName,
- f.create_time createTime,
- f.update_by updateBy,
- f.update_time
- FROM
- t_fee AS f
- LEFT JOIN t_fee_do AS fd ON fd.f_pid = f.f_id
- LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
- left join sys_user u on f.create_by = u.user_name
- left join sys_dept d on f.f_deptid = d.dept_id
- LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
- LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
- LEFT JOIN sys_dict_data pro ON pro.dict_value = f.charging_method and pro.dict_type = 'data_settlement_type'
- <where>
- <if test="fId != null ">and f.f_id = #{fId}</if>
- <if test="fBillno != null and fBillno != ''">and f.f_billno = #{fBillno}</if>
- <if test="fSrcBillno != null and fSrcBillno != ''">and fd.f_src_billno like concat('%', #{fSrcBillno}, '%')</if>
- <if test="fCtrlcorpid != null ">and f.f_ctrlcorpid = #{fCtrlcorpid}</if>
- <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
- <if test="tMblno != null and tMblno != ''">and f.t_mblno = #{tMblno}</if>
- <if test="fAmtdr != null ">and f.f_amtdr = #{fAmtdr}</if>
- <if test="fAmtcr != null ">and f.f_amtcr = #{fAmtcr}</if>
- <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
- <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
- <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%')</if>
- <if test="fAccbilldate != null ">and f.f_accbilldate = #{fAccbilldate}</if>
- <if test="fDeptid != null ">and f.f_deptid = #{fDeptid}</if>
- <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
- and f.f_accbilldate >= #{timeInterval[0]}
- </if>
- <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
- and f.f_accbilldate <= #{timeInterval[1]}
- </if>
- <if test='money != null and money[0] != null and money[0]!= ""'>
- and f.f_amtdr >= #{money[0]}
- </if>
- <if test='money != null and money[1] != null and money[1]!= ""'>
- and f.f_amtdr <= #{money[1]}
- </if>
- <if test='amount != null and amount[0] != null and amount[0]!= ""'>
- and f.f_amtdr >= #{amount[0]}
- </if>
- <if test='amount != null and amount[1] != null and amount[1]!= ""'>
- and f.f_amtdr <= #{amount[1]}
- </if>
- <if test='applyTime != null and applyTime[0] != null and applyTime[0]!= ""'>
- and f.create_time >= #{applyTime[0]}
- </if>
- <if test='applyTime != null and applyTime[1] != null and applyTime[1]!= ""'>
- and f.create_time <= #{applyTime[1]}
- </if>
- <if test="chargingMethod != null ">and f.charging_method = #{chargingMethod}</if>
- <if test="fTotalamount != null ">and f.f_totalamount = #{fTotalamount}</if>
- <if test="invoiceNo != null ">and f.invoice_no = #{invoiceNo}</if>
- <if test="bank != null ">and f.bank = #{bank}</if>
- <if test="waterBillNo != null ">and f.water_bill_no = #{waterBillNo}</if>
- <if test="fSystemType != null and fSystemType != ''">and f.f_system_type = #{fSystemType}</if>
- <if test="createBy != null and createBy != ''">and f.create_by = #{createBy}</if>
- </where>
- ${params.dataScope}
- GROUP BY f.f_billno
- ORDER BY f.f_id desc
- </select>
- <!--凯和查询财务信息-->
- <select id="selectFinancialTFeeList" parameterType="TFee" resultType="com.ruoyi.finance.shipping.FinancialTFee">
- SELECT
- DISTINCT
- f.f_id AS fId,
- f.f_billno AS fBillno,
- f.f_ctrlcorpid AS fCtrlcorpid,
- pro.dict_label AS chargingMethod,
- f.invoice_no AS invoiceNo,
- f.bank AS fBank,
- f.water_bill_no AS waterBillNo,
- f.f_corpid AS fCorpid,
- c.f_name AS fCorpidName,
- f.f_accbilldate AS fAccbilldate,
- f.t_mblno AS tMblno,
- f.f_amtdr AS fAmtdr,
- f.f_amtcr AS fAmtcr,
- f.f_billtype AS fBilltype,
- f.f_system_type AS fSystemType,
- f.f_billstatus AS fBillstatus,
- CASE
- WHEN f.f_billstatus = '1' THEN '新建'
- WHEN f.f_billstatus = '2' THEN '暂存'
- WHEN f.f_billstatus = '3' THEN '审批驳回'
- WHEN f.f_billstatus = '4' THEN '提交审核'
- WHEN f.f_billstatus = '5' THEN '审核中'
- WHEN f.f_billstatus = '6' THEN '审核完成'
- END
- AS fBillstatusName,
- f.f_remarks AS fRemarks,
- f.create_by AS createBy,
- f.create_time AS createTime,
- f.update_by AS updateBy,
- f.update_time AS updateTime,
- tv.f_name AS vessel,
- ty.f_no AS voyage,
- tre.f_name AS loadportName,
- ts.f_name AS destportName,
- f.f_bank_number AS fBankNumber,
- f.bank AS bank,
- f.invoice_remarks AS invoiceRemarks,
- CASE
- WHEN f.f_dc = 'D' THEN
- '收'
- WHEN f.f_dc = 'C' THEN
- '付'
- END AS fSrcdcName
- FROM
- t_fee AS f
- LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
- LEFT JOIN sys_dict_data pro ON pro.dict_value = f.charging_method and pro.dict_type = 'data_settlement_type'
- LEFT JOIN t_vessel tv ON f.f_vslid = tv.f_id
- LEFT JOIN t_voyage ty ON f.f_voyid = ty.f_id
- LEFT JOIN t_address tre ON tre.f_id = f.f_loadportid
- LEFT JOIN t_address ts ON ts.f_id = f.f_destportid
- LEFT JOIN t_fee_do tf ON tf.f_pid = f.f_id
- LEFT JOIN t_warehousebillsfees tb ON tb.f_id = tf.f_srcid
- <where>
- <if test="fId != null ">and f.f_id = #{fId}</if>
- <if test="fBillno != null and fBillno != ''">and f.f_billno like concat('%', #{fBillno}, '%')</if>
- <if test="fCtrlcorpid != null and fCtrlcorpid != ''">and f.f_ctrlcorpid = #{fCtrlcorpid}</if>
- <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
- <if test="tMblno != null and tMblno != ''">and tb.f_mblno like concat('%', #{tMblno}, '%')</if>
- <if test="fAmtdr != null ">and f.f_amtdr = #{fAmtdr}</if>
- <if test="fAmtcr != null ">and f.f_amtcr = #{fAmtcr}</if>
- <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
- <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
- <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks like concat('%', #{fRemarks}, '%')</if>
- <if test="fAccbilldate != null ">and f.f_accbilldate = #{fAccbilldate}</if>
- <if test="fDeptid != null ">and f.f_deptid = #{fDeptid}</if>
- <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
- and f.f_accbilldate >= #{timeInterval[0]}
- </if>
- <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
- and f.f_accbilldate <= #{timeInterval[1]}
- </if>
- <if test='money != null and money[0] != null and money[0]!= ""'>
- and f.f_amtdr >= #{money[0]}
- </if>
- <if test='money != null and money[1] != null and money[1]!= ""'>
- and f.f_amtdr <= #{money[1]}
- </if>
- <if test='amount != null and amount[0] != null and amount[0]!= ""'>
- and f.f_amtdr >= #{amount[0]}
- </if>
- <if test='amount != null and amount[1] != null and amount[1]!= ""'>
- and f.f_amtdr <= #{amount[1]}
- </if>
- <if test='applyTime != null and applyTime[0] != null and applyTime[0]!= ""'>
- and f.create_time >= #{applyTime[0]}
- </if>
- <if test='applyTime != null and applyTime[1] != null and applyTime[1]!= ""'>
- and f.create_time <= #{applyTime[1]}
- </if>
- <if test="chargingMethod != null ">and f.charging_method = #{chargingMethod}</if>
- <if test="fTotalamount != null ">and f.f_totalamount = #{fTotalamount}</if>
- <if test="invoiceNo != null ">and f.invoice_no like concat('%', #{invoiceNo}, '%')</if>
- <if test="bank != null ">and f.bank like concat('%', #{bank}, '%')</if>
- <if test="waterBillNo != null ">and f.water_bill_no like concat('%', #{waterBillNo}, '%')</if>
- <if test="fSystemType != null and fSystemType != ''">and f.f_system_type = #{fSystemType}</if>
- <if test="createBy != null and createBy != ''">and f.create_by = #{createBy}</if>
- <if test="fVslid != null ">and f.f_vslid = #{fVslid}</if>
- <if test="fVoyid != null ">and f.f_voyid = #{fVoyid}</if>
- <if test="fLoadportid != null ">and f.f_loadportid = #{fLoadportid}</if>
- <if test="fDestportid != null ">and f.f_destportid = #{fDestportid}</if>
- <if test="fDc != null and fDc != ''">and f.f_dc = #{fDc}</if>
- <if test="fBankNumber != null and fBankNumber != ''">and f.f_bank_number like concat('%', #{fBankNumber},
- '%')
- </if>
- <if test="fReconciliation != null ">and f.f_reconciliation = #{fReconciliation}</if>
- </where>
- ORDER BY f.f_id desc
- </select>
- <select id="selectTFeeById" parameterType="Long" resultMap="TFeeResult">
- select f.f_id,
- f.f_billno,
- f.f_ctrlcorpid,
- f.f_act_id,
- f.f_corpid,
- c.f_name AS fCorpidName,
- f.t_mblno,
- f.f_trans_act_id,
- f.f_amtdr,
- f.f_amtcr,
- f.f_billtype,
- f.f_billstatus,
- f.f_remarks,
- f.f_from_date,
- f.f_to_date,
- f.f_accbilldate,
- f.f_ref_no,
- f.del_flag,
- f.create_by,
- f.f_deptid,
- f.create_time,
- f.update_by,
- f.update_time,
- f.charging_method,
- f.f_totalamount,
- f.invoice_no,
- f.bank,
- f.water_bill_no,
- f.f_system_type,
- f.f_tracking_number,
- f.f_invoice_rise,
- f.f_sign,
- f.f_send_Time,
- f.f_apply_money,
- f.f_account_id,
- f.f_make,
- f.f_vslid,
- f.f_voyid,
- f.f_loadportid,
- f.f_destportid,
- f.f_dc,
- f.f_bank_number,
- f.f_reconciliation,
- f.invoice_remarks
- from t_fee AS f
- LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
- where f.f_id = #{fId}
- </select>
- <select id="selectTFeeByIdNew" parameterType="Long" resultMap="TFeeResult">
- SELECT f.f_id,
- f.f_billno,
- f.f_ctrlcorpid,
- f.f_corpid,
- c.f_name AS fCorpidName,
- f.f_accbilldate,
- f.t_mblno,
- f.f_amtdr,
- f.f_amtcr,
- f.f_billtype,
- f.f_system_type,
- f.f_billstatus,
- f.f_remarks,
- f.create_by,
- tp.f_name AS createName,
- f.create_time,
- f.update_by,
- f.update_time,
- tn.f_taxrate AS fTaxrate,
- f.charging_method,
- f.f_totalamount,
- f.invoice_no,
- f.bank,
- f.water_bill_no
- FROM t_fee AS f
- LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
- left join sys_user u on f.create_by = u.user_name
- left join sys_dept d on f.f_deptid = d.dept_id
- LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
- LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
- LEFT JOIN(SELECT ti.f_pid, ti.f_taxrate FROM t_fee_invoice ti LIMIT 1) tn ON tn.f_pid = f.f_id
- where f.f_id = #{fId}
- </select>
- <!--凯和确认账单查询-->
- <select id="webVersionTFee" parameterType="TFee" resultType="map">
- SELECT
- f.f_id AS fId,
- f.f_billno AS fBillno,
- f.f_ctrlcorpid AS fCtrlcorpid,
- c.f_name AS fCorpidName,
- f.f_accbilldate AS fAccbilldate,
- f.t_mblno AS tMblno,
- f.f_amtdr AS fAmtdr,
- f.f_amtcr AS fAmtcr,
- f.f_billtype AS filltype,
- f.f_remarks AS fRemarks,
- f.create_by AS createBy,
- tp.f_name AS createName,
- f.create_time AS createTime,
- f.update_by AS updateBy,
- f.update_time AS updateTime,
- tn.f_taxrate AS fTaxrate,
- f.charging_method AS chargingMethod,
- f.f_totalamount AS fTotalamount,
- f.invoice_no AS invoiceNo,
- f.bank AS bank,
- f.water_bill_no AS waterBillNo,
- CASE
- WHEN f.f_billstatus = '1' THEN '新建'
- WHEN f.f_billstatus = '2' THEN '暂存'
- WHEN f.f_billstatus = '3' THEN '审批驳回'
- WHEN f.f_billstatus = '4' THEN '提交审核'
- WHEN f.f_billstatus = '5' THEN '审核中'
- WHEN f.f_billstatus = '6' THEN '审核完成'
- END
- AS fBillstatus
- FROM
- t_fee AS f
- LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
- left join sys_user u on f.create_by = u.user_name
- left join sys_dept d on f.f_deptid = d.dept_id
- LEFT JOIN t_customer_contact tc ON tc.f_tel = u.phonenumber
- LEFT JOIN t_corps tp ON tp.f_id = tc.f_pid
- LEFT JOIN(SELECT ti.f_pid,ti.f_taxrate FROM t_fee_invoice ti LIMIT 1) tn ON tn.f_pid = f.f_id
- <where>
- f.f_make = 0
- <if test="fId != null ">and f.f_id = #{fId}</if>
- <if test="fCorpid != null ">and f.f_corpid = #{fCorpid}</if>
- <if test="createId != null ">and tp.f_id = #{createId}</if>
- <if test="createBy != null and createBy != ''">and f.create_by = #{createBy}</if>
- <if test="fCtrlcorpid != null and fCtrlcorpid != ''">and f.f_ctrlcorpid like concat('%',
- #{fCtrlcorpid},'%')
- </if>
- <if test="fBillstatus != null and fBillstatus != ''">and f.f_billstatus = #{fBillstatus}</if>
- <if test="fBilltype != null and fBilltype != ''">and f.f_billtype = #{fBilltype}</if>
- <if test="fBillno != null and fBillno != ''">and f.f_billno = #{fBillno}</if>
- <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
- and f.f_accbilldate >= #{timeInterval[0]}
- </if>
- <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
- and f.f_accbilldate <= #{timeInterval[1]}
- </if>
- </where>
- ORDER BY f.f_id desc
- </select>
- <insert id="insertTFee" parameterType="TFee" useGeneratedKeys="true" keyProperty="fId">
- insert into t_fee
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="fId != null">f_id,</if>
- <if test="fBillno != null">f_billno,</if>
- <if test="fCtrlcorpid != null">f_ctrlcorpid,</if>
- <if test="fActId != null">f_act_id,</if>
- <if test="fCorpid != null">f_corpid,</if>
- <if test="tMblno != null">t_mblno,</if>
- <if test="fTransActId != null">f_trans_act_id,</if>
- <if test="fAmtdr != null">f_amtdr,</if>
- <if test="fAmtcr != null">f_amtcr,</if>
- <if test="fBilltype != null and fBilltype != ''">f_billtype,</if>
- <if test="fBillstatus != null and fBillstatus != ''">f_billstatus,</if>
- <if test="fRemarks != null">f_remarks,</if>
- <if test="fFromDate != null">f_from_date,</if>
- <if test="fToDate != null">f_to_date,</if>
- <if test="fAccbilldate != null">f_accbilldate,</if>
- <if test="fRefNo != null">f_ref_no,</if>
- <if test="delFlag != null">del_flag,</if>
- <if test="createBy != null">create_by,</if>
- <if test="fDeptid != null">f_deptid,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="chargingMethod != null">charging_method,</if>
- <if test="fTotalamount != null">f_totalamount,</if>
- <if test="invoiceNo != null">invoice_no,</if>
- <if test="bank != null">bank,</if>
- <if test="waterBillNo != null">water_bill_no,</if>
- <if test="fSystemType != null">f_system_type,</if>
- <if test="fTrackingNumber != null">f_tracking_number,</if>
- <if test="fInvoiceRise != null">f_invoice_rise,</if>
- <if test="fSign != null">f_sign,</if>
- <if test="fSendTime != null">f_send_Time,</if>
- <if test="fApplyMoney != null">f_apply_money,</if>
- <if test="fAccountId != null">f_account_id,</if>
- <if test="fMake != null">f_make,</if>
- <if test="fVslid != null">f_vslid,</if>
- <if test="fVoyid != null">f_voyid,</if>
- <if test="fLoadportid != null">f_loadportid,</if>
- <if test="fDestportid != null">f_destportid,</if>
- <if test="fDc != null">f_dc,</if>
- <if test="fBankNumber != null">f_bank_number,</if>
- <if test="fReconciliation != null">f_reconciliation,</if>
- <if test="invoiceRemarks != null">invoice_remarks,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="fId != null">#{fId},</if>
- <if test="fBillno != null">#{fBillno},</if>
- <if test="fCtrlcorpid != null">#{fCtrlcorpid},</if>
- <if test="fActId != null">#{fActId},</if>
- <if test="fCorpid != null">#{fCorpid},</if>
- <if test="tMblno != null">#{tMblno},</if>
- <if test="fTransActId != null">#{fTransActId},</if>
- <if test="fAmtdr != null">#{fAmtdr},</if>
- <if test="fAmtcr != null">#{fAmtcr},</if>
- <if test="fBilltype != null and fBilltype != ''">#{fBilltype},</if>
- <if test="fBillstatus != null and fBillstatus != ''">#{fBillstatus},</if>
- <if test="fRemarks != null">#{fRemarks},</if>
- <if test="fFromDate != null">#{fFromDate},</if>
- <if test="fToDate != null">#{fToDate},</if>
- <if test="fAccbilldate != null">#{fAccbilldate},</if>
- <if test="fRefNo != null">#{fRefNo},</if>
- <if test="delFlag != null">#{delFlag},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="fDeptid != null">#{fDeptid},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="chargingMethod != null">#{chargingMethod},</if>
- <if test="fTotalamount != null">#{fTotalamount},</if>
- <if test="invoiceNo != null">#{invoiceNo},</if>
- <if test="bank != null">#{bank},</if>
- <if test="waterBillNo != null">#{waterBillNo},</if>
- <if test="fSystemType != null">#{fSystemType},</if>
- <if test="fTrackingNumber != null">#{fTrackingNumber},</if>
- <if test="fInvoiceRise != null">#{fInvoiceRise},</if>
- <if test="fSign != null">#{fSign},</if>
- <if test="fSendTime != null">#{fSendTime},</if>
- <if test="fApplyMoney != null">#{fApplyMoney},</if>
- <if test="fAccountId != null">#{fAccountId},</if>
- <if test="fMake != null">#{fMake},</if>
- <if test="fVslid != null">#{fVslid},</if>
- <if test="fVoyid != null">#{fVoyid},</if>
- <if test="fLoadportid != null">#{fLoadportid},</if>
- <if test="fDestportid != null">#{fDestportid},</if>
- <if test="fDc != null">#{fDc},</if>
- <if test="fBankNumber != null">#{fBankNumber},</if>
- <if test="fReconciliation != null">#{fReconciliation},</if>
- <if test="invoiceRemarks != null">#{invoiceRemarks},</if>
- </trim>
- </insert>
- <update id="updateTFee" parameterType="TFee">
- update t_fee
- <trim prefix="SET" suffixOverrides=",">
- <if test="fBillno != null">f_billno = #{fBillno},</if>
- <if test="fCtrlcorpid != null">f_ctrlcorpid = #{fCtrlcorpid},</if>
- <if test="fActId != null">f_act_id = #{fActId},</if>
- <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
- <if test="tMblno != null">t_mblno = #{tMblno},</if>
- <if test="fTransActId != null">f_trans_act_id = #{fTransActId},</if>
- <if test="fAmtdr != null">f_amtdr = #{fAmtdr},</if>
- <if test="fAmtcr != null">f_amtcr = #{fAmtcr},</if>
- <if test="fBilltype != null and fBilltype != ''">f_billtype = #{fBilltype},</if>
- <if test="fBillstatus != null and fBillstatus != ''">f_billstatus = #{fBillstatus},</if>
- <if test="fRemarks != null">f_remarks = #{fRemarks},</if>
- <if test="fFromDate != null">f_from_date = #{fFromDate},</if>
- <if test="fToDate != null">f_to_date = #{fToDate},</if>
- <if test="fAccbilldate != null">f_accbilldate = #{fAccbilldate},</if>
- <if test="fRefNo != null">f_ref_no = #{fRefNo},</if>
- <if test="delFlag != null">del_flag = #{delFlag},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="chargingMethod != null">charging_method = #{chargingMethod},</if>
- <if test="fTotalamount != null">f_totalamount = #{fTotalamount},</if>
- <if test="invoiceNo != null">invoice_no = #{invoiceNo},</if>
- <if test="bank != null">bank = #{bank},</if>
- <if test="waterBillNo != null">water_bill_no = #{waterBillNo},</if>
- <if test="fSystemType != null">f_system_type = #{fSystemType},</if>
- <if test="fTrackingNumber != null">f_tracking_number = #{fTrackingNumber},</if>
- <if test="fInvoiceRise != null">f_invoice_rise = #{fInvoiceRise},</if>
- <if test="fSign != null">f_sign = #{fSign},</if>
- <if test="fSendTime != null">f_send_Time = #{fSendTime},</if>
- <if test="fApplyMoney != null">f_apply_money = #{fApplyMoney},</if>
- <if test="fAccountId != null">f_account_id = #{fAccountId},</if>
- <if test="fMake != null">f_make = #{fMake},</if>
- <if test="fVslid != null">f_vslid = #{fVslid},</if>
- <if test="fVoyid != null">f_voyid = #{fVoyid},</if>
- <if test="fLoadportid != null">f_loadportid = #{fLoadportid},</if>
- <if test="fDestportid != null">f_destportid = #{fDestportid},</if>
- <if test="fDc != null">f_dc = #{fDc},</if>
- <if test="fBankNumber != null">f_bank_number = #{fBankNumber},</if>
- <if test="fReconciliation != null">f_reconciliation = #{fReconciliation},</if>
- <if test="invoiceRemarks != null">invoice_remarks = #{invoiceRemarks},</if>
- </trim>
- where f_id = #{fId}
- </update>
- <delete id="deleteTFeeById" parameterType="Long">
- delete
- from t_fee
- where f_id = #{fId}
- </delete>
- <delete id="deleteTFeeByIds" parameterType="String">
- delete
- f.*,
- fd.* ,
- fi.*
- from
- t_fee f
- LEFT JOIN t_fee_do fd ON fd.f_pid = f.f_id
- LEFT JOIN t_fee_invoice fi ON fi.f_pid = f.f_id
- where f.f_id in
- <foreach item="fId" collection="array" open="(" separator="," close=")">
- #{fId}
- </foreach>
- </delete>
- <select id="warehouseBillsFeesList" resultType="java.util.Map">
- SELECT
- w.f_id AS fSrcid,
- t.f_id AS fSrcpid,
- t.f_corpid AS fCorpid,
- t.f_billno AS fBillno,
- c.f_name AS fName,
- c.f_id AS fId,
- c.f_name AS fFeesName,
- t.f_bscorpno AS fBscorpno,
- w.f_mblno AS fMblno,
- w.f_product_name AS fProductName,
- w.f_bsdate AS fBsdate,
- t.f_billtype AS fBilltype,
- t.f_review_date AS fReviewDate,
- w.f_feeid AS fFeeid,
- w.src_bill_no AS srcBillNo,
- w.f_marks AS fMarks,
- w.f_chargedate AS fChargedate,
- w.f_billing_days AS fBillingDays,
- w.f_billing_deadline AS fBillingDeadline,
- w.f_inventory_days AS fInventoryDays,
- w.f_originalbilldate AS fOriginalbilldate,
- f.f_name AS fFeeName,
- w.f_dc AS fSrcdc,
- CASE
- WHEN w.f_dc = 'D' THEN
- '收'
- WHEN w.f_dc = 'C' THEN
- '付'
- END AS fSrcdcName,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
- w.f_business_type AS fBusinessType,
- w.remark AS fRemarks
- FROM
- t_warehousebillsfees w
- LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
- LEFT JOIN t_corps c ON c.f_id = w.f_corpid
- LEFT JOIN t_fees f ON w.f_feeid = f.f_id
- <where>
- <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
- #{map.tWareHouseFees.fCorpid}
- </if>
- <if test="map.tWareHouseFees.stlTypeid != null and map.tWareHouseFees.stlTypeid != ''">and w.f_stltypeid = #{map.tWareHouseFees.stlTypeid}</if>
- <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
- #{map.tWareHouseFees.fToCorpid}
- </if>
- <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
- <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
- <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
- concat('%', #{map.tWareHouseFees.fMblno}, '%')
- </if>
- <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
- w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
- </if>
- <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
- and w.f_accamount_date IS NOT NULL
- </if>
- <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
- and w.f_accamount_date IS NULL
- </if>
- <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
- and w.f_dc = #{map.tWareHouseFees.fDc}
- </if>
- <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
- and w.f_dc = #{map.tWareHouseFees.fDc}
- </if>
- <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
- and w.f_feeid in
- <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
- and w.f_review_date >= #{map.tWareHouseFees.timeExamine[0]}
- </if>
- <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
- and w.f_review_date <= #{map.tWareHouseFees.timeExamine[1]}
- </if>
- <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
- and w.f_bsdate >= #{map.tWareHouseFees.timeInterval[0]}
- </if>
- <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
- and w.f_bsdate <= #{map.tWareHouseFees.timeInterval[1]}
- </if>
- <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
- and w.f_accamount_date >= #{map.tWareHouseFees.timeReconci[0]}
- </if>
- <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
- and w.f_accamount_date <= #{map.tWareHouseFees.timeReconci[1]}
- </if>
- <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
- and w.f_billtype = #{map.tWareHouseFees.fBilltype}
- </if>
- <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
- and w.f_billtype = #{map.tWareHouseFees.fBilltype}
- </if>
- <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
- and w.f_billtype = #{map.tWareHouseFees.fBilltype}
- </if>
- <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
- and w.f_billtype = #{map.tWareHouseFees.fBilltype}
- </if>
- <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
- and w.f_business_type in
- <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
- and w.f_id in
- <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
- and t.f_id in
- <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
- </if>
- and w.f_review_date IS NOT NULL
- and abs(IFNULL(w.f_amount, 0) - IFNULL(w.f_stlamount, 0)) > 0
- GROUP BY w.f_id
- </where>
- </select>
- <select id="warehouseApplyFPFeesList" resultType="java.util.Map">
- SELECT
- w.f_id AS fSrcid,
- t.f_id AS fSrcpid,
- t.f_corpid AS fCorpid,
- c.f_name AS fName,
- w.fId AS fId,
- w.fName AS fFeesName,
- t.f_bscorpno AS fBscorpno,
- w.f_mblno AS fMblno,
- w.f_product_name AS fProductName,
- w.f_bsdate AS fBsdate,
- t.f_billtype AS fBilltype,
- t.f_review_date AS fReviewDate,
- w.f_feeid AS fFeeid,
- w.src_bill_no AS srcBillNo,
- w.f_marks AS fMarks,
- w.f_chargedate AS fChargedate,
- w.f_billing_days AS fBillingDays,
- w.f_billing_deadline AS fBillingDeadline,
- w.f_inventory_days AS fInventoryDays,
- w.f_originalbilldate AS fOriginalbilldate,
- f.f_name AS fFeeName,
- w.f_dc AS fSrcdc,
- CASE
- WHEN w.f_dc = 'D' THEN '收'
- WHEN w.f_dc = 'C' THEN '付'
- END AS fSrcdcName,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_askamount, 0 ) AS fAmtdr,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_askamount, 0 ) AS fAmt,
- dict.dict_label AS fFeeunitid,
- w.f_qty AS fQty,
- w.f_unitprice AS fUnitprice,
- w.f_currency AS fCurreny,
- w.f_taxrate AS fTaxrate,
- w.remark AS remark,
- tv.f_name AS boatName,
- ty.f_no AS voyageName,
- w.create_time createTime,
- w.businessName,
- t.f_loadportid AS fLoadportid,
- t.f_destportid AS fDestportid
- FROM
- t_warehousebills t
- LEFT JOIN t_corps c ON c.f_id = t.f_corpid
- LEFT JOIN (
- SELECT
- f.f_id AS f_id,
- f.f_pid AS f_pid,
- f.f_lineno AS f_lineno,
- f.f_corpid,
- f.f_feeid,
- f.f_feeUnitid,
- f.f_qty,
- f.f_unitprice,
- f.f_amount,
- f.f_currency,
- f.f_exrate,
- f.f_taxrate,
- f.f_dc,
- f.f_billstatus,
- f.f_statement_no,
- f.f_accamount,
- f.f_accamount_date,
- f.f_stlamount_no,
- f.f_stlamount,
- f.f_stlamount_date,
- f.f_invnos,
- f.f_invamount,
- f.f_askamount,
- f.f_chargedate,
- f.f_status,
- f.remark,
- f.f_mblno,
- f.f_product_name,
- f.src_bill_no,
- f.f_billing_days,
- f.f_inventory_days,
- f.f_marks,
- f.f_billing_deadline,
- f.f_originalbilldate,
- f.f_billtype,
- f.f_business_type,
- pro.dict_label businessName,
- f.f_bsdate,
- c.f_id AS fId,
- c.f_name AS fName,f.create_time
- FROM
- t_warehousebillsfees AS f
- LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
- LEFT JOIN sys_dict_data pro ON pro.dict_value = f.f_business_type
- ) w ON w.f_pid = t.f_id
- LEFT JOIN t_fees f ON w.f_feeid = f.f_id
- LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
- LEFT JOIN t_vessel tv ON tv.f_id = t.f_vslid
- LEFT JOIN t_voyage ty ON ty.f_id = t.f_voyid
- <where>
- dict.status = '0'
- AND dict.dict_type = 'data_unitfees'
- <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
- #{map.tWareHouseFees.fCorpid}
- </if>
- <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
- #{map.tWareHouseFees.fToCorpid}
- </if>
- <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
- <if test="map.tWareHouseFees.fLoadportid != null ">and t.f_loadportid = #{map.tWareHouseFees.fLoadportid}
- </if>
- <if test="map.tWareHouseFees.fDestportid != null ">and t.f_destportid = #{map.tWareHouseFees.fDestportid}
- </if>
- <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
- <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
- concat('%', #{map.tWareHouseFees.fMblno}, '%')
- </if>
- <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
- w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
- </if>
- <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
- and w.f_accamount_date IS NOT NULL
- </if>
- <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
- and w.f_accamount_date IS NULL
- </if>
- <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
- and w.f_dc = #{map.tWareHouseFees.fDc}
- </if>
- <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
- and w.f_dc = #{map.tWareHouseFees.fDc}
- </if>
- <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
- and w.f_feeid in
- <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
- and t.f_review_date >= #{map.tWareHouseFees.timeExamine[0]}
- </if>
- <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
- and t.f_review_date <= #{map.tWareHouseFees.timeExamine[1]}
- </if>
- <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
- and w.create_time >= #{map.tWareHouseFees.createTimeList[0]}
- </if>
- <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
- and w.create_time <= #{map.tWareHouseFees.createTimeList[1]}
- </if>
- <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
- and t.f_bsdate >= #{map.tWareHouseFees.timeInterval[0]}
- </if>
- <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
- and t.f_bsdate <= #{map.tWareHouseFees.timeInterval[1]}
- </if>
- <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
- and w.f_accamount_date >= #{map.tWareHouseFees.timeReconci[0]}
- </if>
- <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
- and w.f_accamount_date <= #{map.tWareHouseFees.timeReconci[1]}
- </if>
- <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
- and w.f_business_type in
- <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
- and w.f_id in
- <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
- and t.f_id in
- <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fVslid != null">and tv.f_vslid = #{map.tWareHouseFees.fVslid}</if>
- <if test="map.tWareHouseFees.fVoyid != null">and ty.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
- <if test="map.tWareHouseFees.boatName != null and map.tWareHouseFees.boatName != ''">and tv.f_name =
- #{map.tWareHouseFees.boatName}
- </if>
- <if test="map.tWareHouseFees.voyageName != null and map.tWareHouseFees.voyageName != ''">and ty.f_no like
- concat('%', #{map.tWareHouseFees.voyageName}, '%')
- </if>
- <if test="map.tWareHouseFees.fName != null and map.tWareHouseFees.fName != ''">and c.f_name like
- concat('%', #{map.tWareHouseFees.fName}, '%')
- </if>
- <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
- </if>
- and t.f_review_date IS NOT NULL
- and ifnull(w.f_amount, 0) - ifnull(w.f_askamount, 0) > 0
- GROUP BY w.f_id
- </where>
- </select>
- <select id="warehouseInvoiceFPFeesList" resultType="java.util.Map">
- SELECT
- w.f_id AS fSrcid,
- t.f_id AS fSrcpid,
- t.f_corpid AS fCorpid,
- c.f_name AS fName,
- w.fId AS fId,
- w.fName AS fFeesName,
- t.f_bscorpno AS fBscorpno,
- w.f_mblno AS fMblno,
- w.f_product_name AS fProductName,
- w.f_bsdate AS fBsdate,
- t.f_billtype AS fBilltype,
- t.f_review_date AS fReviewDate,
- w.f_feeid AS fFeeid,
- w.src_bill_no AS srcBillNo,
- w.f_marks AS fMarks,
- w.f_chargedate AS fChargedate,
- w.f_billing_days AS fBillingDays,
- w.f_billing_deadline AS fBillingDeadline,
- w.f_inventory_days AS fInventoryDays,
- w.f_originalbilldate AS fOriginalbilldate,
- f.f_name AS fFeeName,
- w.f_dc AS fSrcdc,
- CASE
- WHEN w.f_dc = 'D' THEN '收'
- WHEN w.f_dc = 'C' THEN '付'
- END AS fSrcdcName,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmtdr,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmt,
- dict.dict_label AS fFeeunitid,
- w.f_qty AS fQty,
- w.f_unitprice AS fUnitprice,
- w.f_currency AS fCurreny,
- w.f_taxrate AS fTaxrate,
- w.remark AS remark,
- tv.f_name AS boatName,
- ty.f_no AS voyageName,
- w.create_time createTime,
- w.businessName
- FROM
- t_warehousebills t
- LEFT JOIN t_corps c ON c.f_id = t.f_corpid
- LEFT JOIN (
- SELECT
- f.f_id AS f_id,
- f.f_pid AS f_pid,
- f.f_lineno AS f_lineno,
- f.f_corpid,
- f.f_feeid,
- f.f_feeUnitid,
- f.f_qty,
- f.f_unitprice,
- f.f_amount,
- f.f_currency,
- f.f_exrate,
- f.f_taxrate,
- f.f_dc,
- f.f_billstatus,
- f.f_statement_no,
- f.f_accamount,
- f.f_accamount_date,
- f.f_stlamount_no,
- f.f_stlamount,
- f.f_stlamount_date,
- f.f_invnos,
- f.f_invamount,
- f.f_askamount,
- f.f_chargedate,
- f.f_status,
- f.remark,
- f.f_mblno,
- f.f_product_name,
- f.src_bill_no,
- f.f_billing_days,
- f.f_inventory_days,
- f.f_marks,
- f.f_billing_deadline,
- f.f_originalbilldate,
- f.f_billtype,
- f.f_business_type,
- pro.dict_label businessName,
- f.f_bsdate,
- c.f_id AS fId,
- c.f_name AS fName,f.create_time
- FROM
- t_warehousebillsfees AS f
- LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
- LEFT JOIN sys_dict_data pro ON pro.dict_value = f.f_business_type
- ) w ON w.f_pid = t.f_id
- LEFT JOIN t_fees f ON w.f_feeid = f.f_id
- LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
- LEFT JOIN t_vessel tv ON tv.f_id = t.f_vslid
- LEFT JOIN t_voyage ty ON ty.f_id = t.f_voyid
- <where>
- dict.status = '0'
- AND dict.dict_type = 'data_unitfees'
- <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
- #{map.tWareHouseFees.fCorpid}
- </if>
- <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
- #{map.tWareHouseFees.fToCorpid}
- </if>
- <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
- <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
- <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
- concat('%', #{map.tWareHouseFees.fMblno}, '%')
- </if>
- <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
- w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
- </if>
- <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
- and w.f_accamount_date IS NOT NULL
- </if>
- <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
- and w.f_accamount_date IS NULL
- </if>
- <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
- and w.f_dc = #{map.tWareHouseFees.fDc}
- </if>
- <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
- and w.f_dc = #{map.tWareHouseFees.fDc}
- </if>
- <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
- and w.f_feeid in
- <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
- and t.f_review_date >= #{map.tWareHouseFees.timeExamine[0]}
- </if>
- <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
- and t.f_review_date <= #{map.tWareHouseFees.timeExamine[1]}
- </if>
- <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
- and w.create_time >= #{map.tWareHouseFees.createTimeList[0]}
- </if>
- <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
- and w.create_time <= #{map.tWareHouseFees.createTimeList[1]}
- </if>
- <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
- and t.f_bsdate >= #{map.tWareHouseFees.timeInterval[0]}
- </if>
- <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
- and t.f_bsdate <= #{map.tWareHouseFees.timeInterval[1]}
- </if>
- <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
- and w.f_accamount_date >= #{map.tWareHouseFees.timeReconci[0]}
- </if>
- <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
- and w.f_accamount_date <= #{map.tWareHouseFees.timeReconci[1]}
- </if>
- <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
- and w.f_business_type in
- <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
- and w.f_id in
- <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
- and t.f_id in
- <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fVslid != null">and tv.f_vslid = #{map.tWareHouseFees.fVslid}</if>
- <if test="map.tWareHouseFees.fVoyid != null">and ty.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
- <if test="map.tWareHouseFees.boatName != null and map.tWareHouseFees.boatName != ''">and tv.f_name =
- #{map.tWareHouseFees.boatName}
- </if>
- <if test="map.tWareHouseFees.voyageName != null and map.tWareHouseFees.voyageName != ''">and ty.f_no =
- #{map.tWareHouseFees.voyageName}
- </if>
- <if test="map.tWareHouseFees.fName != null and map.tWareHouseFees.fName != ''">and c.f_name = like
- concat('%', #{map.tWareHouseFees.fName}, '%')
- </if>
- <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
- </if>
- and t.f_review_date IS NOT NULL
- and ifnull(w.f_amount, 0) - ifnull(w.f_invamount, 0) > 0
- GROUP BY w.f_id
- </where>
- </select>
- <select id="warehouseBillsFeesListAccamount" resultType="java.util.Map">
- SELECT
- w.f_id AS fSrcid,
- t.f_id AS fSrcpid,
- t.f_corpid AS fCorpid,
- c.f_name AS fName,
- c.f_name AS fFeesName,
- t.f_bscorpno AS fBscorpno,
- t.f_billno AS fBillno,
- w.f_mblno AS fMblno,
- w.f_invnos as invoiceNo,
- w.f_product_name AS fProductName,
- w.f_bsdate AS fBsdate,
- t.f_billtype AS fBilltype,
- t.f_review_date AS fReviewDate,
- w.f_marks AS fMarks,
- w.f_feeid AS fFeeid,
- w.f_billtype AS fBilltype,
- w.f_chargedate AS fChargedate,
- w.f_originalbilldate AS fOriginalbilldate,
- w.f_billing_deadline AS fBillingDeadline,
- w.f_billing_days AS fBillingDays,
- w.f_inventory_days AS fInventoryDays,
- f.f_name AS fFeeName,
- w.f_dc AS fSrcdc,
- CASE
- WHEN w.f_taxrate = 0 THEN '0.00%'
- WHEN w.f_taxrate != 0 THEN CONCAT(w.f_taxrate,'%')
- END AS fTaxrate,
- CASE
- WHEN w.f_dc = 'D' THEN
- '收'
- WHEN w.f_dc = 'C' THEN
- '付'
- END AS fSrcdcName,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
- dict.dict_label AS fFeeunitid,
- w.f_qty AS fQty,
- w.f_unitprice AS fUnitprice,
- w.f_business_type AS fBusinessType,
- w.remark AS fRemarks
- FROM
- t_warehousebillsfees w
- LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
- LEFT JOIN t_corps c ON c.f_id = w.f_corpid
- LEFT JOIN t_fees f ON w.f_feeid = f.f_id
- LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
- <where>
- dict.status = '0'
- AND dict.dict_type = 'data_unitfees'
- <if test="map.tWareHouseFees.stlTypeid != null">and w.f_stltypeid = #{map.tWareHouseFees.stlTypeid}</if>
- <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
- #{map.tWareHouseFees.fCorpid}
- </if>
- <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
- <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
- <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
- #{map.tWareHouseFees.fToCorpid}
- </if>
- <if test="map.tWareHouseFees.fBillno != null and map.tWareHouseFees.fBillno != ''">and t.f_billno like
- concat('%', #{map.tWareHouseFees.fBillno}, '%')
- </if>
- <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
- concat('%', #{map.tWareHouseFees.fMblno}, '%')
- </if>
- <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
- w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
- </if>
- <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
- and w.f_accamount_date IS NOT NULL
- </if>
- <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
- and w.f_accamount_date IS NULL
- </if>
- <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
- and w.f_dc = #{map.tWareHouseFees.fDc}
- </if>
- <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
- and w.f_dc = #{map.tWareHouseFees.fDc}
- </if>
- <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
- and w.f_feeid in
- <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
- and w.f_review_date >= #{map.tWareHouseFees.timeExamine[0]}
- </if>
- <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
- and w.f_review_date <= #{map.tWareHouseFees.timeExamine[1]}
- </if>
- <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
- and w.f_bsdate >= #{map.tWareHouseFees.timeInterval[0]}
- </if>
- <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
- and w.f_bsdate <= #{map.tWareHouseFees.timeInterval[1]}
- </if>
- <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
- and w.f_accamount_date >= #{map.tWareHouseFees.timeReconci[0]}
- </if>
- <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
- and w.f_accamount_date <= #{map.tWareHouseFees.timeReconci[1]}
- </if>
- <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
- and w.f_billtype = #{map.tWareHouseFees.fBilltype}
- </if>
- <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
- and w.f_billtype = #{map.tWareHouseFees.fBilltype}
- </if>
- <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
- and w.f_billtype = #{map.tWareHouseFees.fBilltype}
- </if>
- <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
- and w.f_billtype = #{map.tWareHouseFees.fBilltype}
- </if>
- <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
- and w.f_business_type in
- <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
- and w.f_id in
- <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
- and t.f_id in
- <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
- </if>
- <if test='map.tWareHouseFees.createBy != null and map.tWareHouseFees.createBy != ""'>
- and w.create_by = #{map.tWareHouseFees.createBy}
- </if>
- and w.f_review_date IS NOT NULL
- and abs(IFNULL(w.f_amount, 0) - IFNULL(w.f_accamount, 0)) > 0
- GROUP BY w.f_id
- </where>
- </select>
- <!--
- <select id="warehouseBillsFeesListAccamount" resultType="java.util.Map">
- SELECT
- w.f_id AS fSrcid,
- t.f_id AS fSrcpid,
- t.f_corpid AS fCorpid,
- c.f_name AS fName,
- w.fName AS fFeesName,
- t.f_bscorpno AS fBscorpno,
- w.f_mblno AS fMblno,
- w.f_product_name AS fProductName,
- w.f_bsdate AS fBsdate,
- t.f_billtype AS fBilltype,
- t.f_review_date AS fReviewDate,
- w.f_marks AS fMarks,
- w.f_feeid AS fFeeid,
- w.f_billtype AS fBilltype,
- w.f_chargedate AS fChargedate,
- w.f_originalbilldate AS fOriginalbilldate,
- w.f_billing_deadline AS fBillingDeadline,
- w.f_billing_days AS fBillingDays,
- w.f_inventory_days AS fInventoryDays,
- f.f_name AS fFeeName,
- w.f_dc AS fSrcdc,
- CASE
- WHEN w.f_dc = 'D' THEN '收'
- WHEN w.f_dc = 'C' THEN '付'
- END AS fSrcdcName,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
- dict.dict_label AS fFeeunitid,
- w.f_qty AS fQty ,
- w.f_unitprice AS fUnitprice ,
- dictIn.dict_label AS fBusinessType
- FROM
- t_warehousebills t
- LEFT JOIN t_corps c ON c.f_id = t.f_corpid
- LEFT JOIN (
- SELECT
- f.f_id AS f_id,
- f.f_pid AS f_pid,
- f.f_lineno AS f_lineno,
- f.f_corpid,
- f.f_feeid,
- f.f_feeUnitid,
- f.f_qty,
- f.f_unitprice,
- f.f_amount,
- f.f_currency,
- f.f_exrate,
- f.f_taxrate,
- f.f_dc,
- f.f_billstatus,
- f.f_statement_no,
- f.f_accamount,
- f.f_accamount_date,
- f.f_stlamount_no,
- f.f_stlamount,
- f.f_stlamount_date,
- f.f_invnos,
- f.f_invamount,
- f.f_askamount,
- f.f_status,
- f.remark,
- f.f_inventory_days,
- f.f_billing_days,
- f.f_billing_deadline,
- f.f_originalbilldate,
- f.f_mblno,
- f.f_product_name,
- f.f_chargedate,
- f.src_bill_no,
- f.f_billtype,
- f.f_marks,
- f.f_business_type,
- f.f_bsdate,
- c.f_id AS fId,
- c.f_name AS fName
- FROM
- t_warehousebillsfees AS f
- LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
- ) w ON w.f_pid = t.f_id
- LEFT JOIN t_fees f ON w.f_feeid = f.f_id
- LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
- LEFT JOIN sys_dict_data dictIn ON dictIn.dict_value = w.f_business_type
- <where>
- dict.status = '0'
- AND dict.dict_type = 'data_unitfees'
- <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
- #{map.tWareHouseFees.fCorpid}
- </if>
- <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
- <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
- <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
- #{map.tWareHouseFees.fToCorpid}
- </if>
- <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
- concat('%', #{map.tWareHouseFees.fMblno}, '%')
- </if>
- <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
- w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
- </if>
- <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
- and w.f_accamount_date IS NOT NULL
- </if>
- <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
- and w.f_accamount_date IS NULL
- </if>
- <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
- and w.f_dc = #{map.tWareHouseFees.fDc}
- </if>
- <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
- and w.f_dc = #{map.tWareHouseFees.fDc}
- </if>
- <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
- and w.f_feeid in
- <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
- and t.f_review_date >= #{map.tWareHouseFees.timeExamine[0]}
- </if>
- <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
- and t.f_review_date <= #{map.tWareHouseFees.timeExamine[1]}
- </if>
- <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
- and t.f_bsdate >= #{map.tWareHouseFees.timeInterval[0]}
- </if>
- <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
- and t.f_bsdate <= #{map.tWareHouseFees.timeInterval[1]}
- </if>
- <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
- and w.f_accamount_date >= #{map.tWareHouseFees.timeReconci[0]}
- </if>
- <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
- and w.f_accamount_date <= #{map.tWareHouseFees.timeReconci[1]}
- </if>
- <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
- and w.f_billtype = #{map.tWareHouseFees.fBilltype}
- AND dictIn.dict_type = 'st_in_type'
- AND dictIn.status = '0'
- </if>
- <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
- and w.f_billtype = #{map.tWareHouseFees.fBilltype}
- AND dictIn.dict_type = 'st_out_type'
- AND dictIn.status = '0'
- </if>
- <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
- and w.f_billtype = #{map.tWareHouseFees.fBilltype}
- AND dictIn.dict_type = 'st_trans_type'
- AND dictIn.status = '0'
- </if>
- <if test="map.tWareHouseFees.fBilltype == null ">
- AND dictIn.dict_type in ('st_in_type','st_out_type','st_trans_type')
- AND dictIn.status = '0'
- </if>
- <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
- and w.f_billtype = #{map.tWareHouseFees.fBilltype}
- </if>
- <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
- and w.f_business_type in
- <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
- and w.f_id in
- <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
- and t.f_id in
- <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
- </if>
- <if test='map.tWareHouseFees.createBy != null and map.tWareHouseFees.createBy != ""'>
- and t.create_by = #{map.tWareHouseFees.createBy}
- </if>
- and t.f_review_date IS NOT NULL
- and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
- GROUP BY w.f_id
- </where>
- </select>
- -->
- <select id="warehouseBillsKHFeesListAccamount" resultType="java.util.Map">
- SELECT
- w.f_id AS fSrcid,
- t.f_id AS fSrcpid,
- t.f_corpid AS fCorpid,
- t.f_billno fBillno,
- c.f_name AS fName,
- w.fName AS fFeesName,
- t.f_bscorpno AS fBscorpno,
- w.f_mblno AS fMblno,
- w.f_product_name AS fProductName,
- w.f_bsdate AS fBsdate,
- t.f_billtype AS tfBilltype,
- t.f_review_date AS fReviewDate,
- w.f_marks AS fMarks,
- w.f_feeid AS fFeeid,
- w.f_billtype AS wfBilltype,
- w.f_chargedate AS fChargedate,
- w.f_originalbilldate AS fOriginalbilldate,
- w.f_billing_deadline AS fBillingDeadline,
- w.f_billing_days AS fBillingDays,
- w.f_inventory_days AS fInventoryDays,
- f.f_name AS fFeeName,
- w.f_dc AS fSrcdc,
- CASE
- WHEN w.f_dc = 'D' THEN '收'
- WHEN w.f_dc = 'C' THEN '付'
- END AS fSrcdcName,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
- dict.dict_label AS fFeeunitid,
- w.f_qty AS fQty,
- w.f_unitprice AS fUnitprice,
- w.f_currency AS fCurreny,
- w.f_taxrate AS fTaxrate,
- w.remark AS remark,
- tv.f_name AS boatName,
- ty.f_no AS voyageName,
- w.create_time createTime,
- w.businessName
- FROM
- t_warehousebills t
- LEFT JOIN t_corps c ON c.f_id = t.f_corpid
- LEFT JOIN (
- SELECT
- f.f_id AS f_id,
- f.f_pid AS f_pid,
- f.f_lineno AS f_lineno,
- f.f_corpid,
- f.f_feeid,
- f.f_feeUnitid,
- f.f_qty,
- f.f_unitprice,
- f.f_amount,
- f.f_currency,
- f.f_exrate,
- f.f_taxrate,
- f.f_dc,
- f.f_billstatus,
- f.f_statement_no,
- f.f_accamount,
- f.f_accamount_date,
- f.f_stlamount_no,
- f.f_stlamount,
- f.f_stlamount_date,
- f.f_invnos,
- f.f_invamount,
- f.f_askamount,
- f.f_status,
- f.remark,
- f.f_inventory_days,
- f.f_billing_days,
- f.f_billing_deadline,
- f.f_originalbilldate,
- f.f_mblno,
- f.f_product_name,
- f.f_chargedate,
- f.src_bill_no,
- f.f_billtype,
- f.f_marks,
- f.f_business_type,
- pro.dict_label businessName,
- f.f_bsdate,
- c.f_id AS fId,
- c.f_name AS fName,
- f.create_time
- FROM
- t_warehousebillsfees AS f
- LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
- LEFT JOIN sys_dict_data pro ON pro.dict_value = f.f_business_type and pro.dict_type = 'data_billType'
- ) w ON w.f_pid = t.f_id
- LEFT JOIN t_fees f ON w.f_feeid = f.f_id
- LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
- LEFT JOIN t_vessel tv ON tv.f_id = t.f_vslid
- LEFT JOIN t_voyage ty ON ty.f_id = t.f_voyid
- <where>
- dict.status = '0'
- AND dict.dict_type = 'data_unitfees'
- <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and t.f_corpid =
- #{map.tWareHouseFees.fToCorpid}
- </if>
- <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
- <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
- <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
- #{map.tWareHouseFees.fCorpid}
- </if>
- <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
- concat('%', #{map.tWareHouseFees.fMblno}, '%')
- </if>
- <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
- w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
- </if>
- <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
- and w.f_accamount_date IS NOT NULL
- </if>
- <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
- and w.f_accamount_date IS NULL
- </if>
- <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
- and w.f_dc = #{map.tWareHouseFees.fDc}
- </if>
- <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
- and w.f_dc = #{map.tWareHouseFees.fDc}
- </if>
- <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
- and w.f_feeid in
- <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
- and t.f_review_date >= #{map.tWareHouseFees.timeExamine[0]}
- </if>
- <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
- and t.f_review_date <= #{map.tWareHouseFees.timeExamine[1]}
- </if>
- <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[0] != null and map.tWareHouseFees.createTimeList[0]!= ""'>
- and w.create_time >= #{map.tWareHouseFees.createTimeList[0]}
- </if>
- <if test='map.tWareHouseFees.createTimeList != null and map.tWareHouseFees.createTimeList[1] != null and map.tWareHouseFees.createTimeList[1]!= ""'>
- and w.create_time <= #{map.tWareHouseFees.createTimeList[1]}
- </if>
- <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
- and t.f_bsdate >= #{map.tWareHouseFees.timeInterval[0]}
- </if>
- <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
- and t.f_bsdate <= #{map.tWareHouseFees.timeInterval[1]}
- </if>
- <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
- and w.f_accamount_date >= #{map.tWareHouseFees.timeReconci[0]}
- </if>
- <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
- and w.f_accamount_date <= #{map.tWareHouseFees.timeReconci[1]}
- </if>
- <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
- and w.f_business_type in
- <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fVslid != null">and tv.f_vslid = #{map.tWareHouseFees.fVslid}</if>
- <if test="map.tWareHouseFees.fVoyid != null">and ty.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
- <if test="map.tWareHouseFees.boatName != null and map.tWareHouseFees.boatName != ''">and tv.f_name =
- #{map.tWareHouseFees.boatName}
- </if>
- <if test="map.tWareHouseFees.voyageName != null and map.tWareHouseFees.voyageName != ''">and ty.f_no =
- #{map.tWareHouseFees.voyageName}
- </if>
- <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
- </if>
- and t.f_review_date IS NOT NULL
- and ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0) > 0
- GROUP BY w.f_id
- </where>
- </select>
- <select id="warehouseBillsFeesList1" resultType="java.util.Map">
- SELECT
- w.f_id AS fSrcid,
- t.f_id AS fSrcpid,
- t.f_corpid AS fCorpid,
- c.f_name AS fName,
- w.f_corpid AS fCorpids,
- c1.f_name AS fFeesName,
- w.f_mblno AS fMblno,
- w.f_product_name AS fProductName,
- w.f_marks AS fMarks,
- t.f_billtype AS fBilltype,
- t.f_review_date AS fReviewDate,
- w.f_dc AS fSrcdc,
- SUM(w.f_amount) AS fAmount,
- SUM(w.f_stlamount) AS fStlamount,
- ifnull(SUM( w.f_amount ) , 0 ) - ifnull( SUM( w.f_stlamount ) , 0 ) AS nnfinished
- FROM
- t_warehousebills t
- left join sys_user u on t.create_by = u.user_name
- left join sys_dept d on t.f_bsdeptid = d.dept_id
- LEFT JOIN t_corps c ON c.f_id = t.f_corpid
- LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
- LEFT JOIN t_corps c1 ON w.f_corpid = c1.f_id
- LEFT JOIN t_fees f ON w.f_feeid = f.f_id
- <where>
- <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
- <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
- <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
- <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
- <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',
- #{fProductName}, '%')
- </if>
- <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
- and w.f_billstatus != 6
- </if>
- <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
- and w.f_billstatus = 6
- </if>
- <if test='fDc != null and fDc != "" and fDc == "D" '>
- and w.f_dc = #{fDc}
- </if>
- <if test='fDc != null and fDc != "" and fDc == "C" '>
- and w.f_dc = #{fDc}
- </if>
- <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
- and t.f_review_date >= #{timeExamine[0]}
- </if>
- <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
- and t.f_review_date <= #{timeExamine[1]}
- </if>
- <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
- and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
- </if>
- and w.f_review_date IS NOT NULL
- ${params.dataScope}
- GROUP BY
- w.f_pid,
- w.f_dc,
- w.f_corpid
- </where>
- </select>
- <select id="selectTWarehousebillsItemsList"
- resultType="com.ruoyi.warehouseBusiness.excel.TWareHouseExcelItem">
- SELECT (@ii := @ii + 1) AS fId,
- wi.f_mblno AS fMblno,
- wi.f_bsdate AS fBsdate,
- f.f_name AS fFeeid,
- CASE
- WHEN w.f_srcdc = 'D' THEN
- '收'
- WHEN w.f_srcdc = 'C' THEN
- '付'
- END AS fSrcdc,
- w.f_amtdr AS fAmtdr,
- dict.dict_label AS fFeeunitid,
- wi.f_qty AS fBillingQty,
- wi.f_unitprice AS fUnitprice,
- w.f_amt AS fAmt,
- w.f_src_billno AS fSrcBillno,
- wi.f_business_type AS fBusinessType,
- CASE
- wi.f_billtype
- WHEN 'SJRK' THEN
- '入库'
- WHEN 'SJCK' THEN
- '出库'
- WHEN 'HQZY' THEN
- '货转'
- WHEN 'CKDB' THEN
- '调拨'
- WHEN 'HWTG' THEN
- '货物通关'
- WHEN 'KCZZ' THEN
- '库存总账'
- END AS fBilltype,
- wi.f_product_name AS fGoodsid,
- wi.f_marks AS fMarks,
- wi.f_chargedate AS fChargedate,
- wi.f_billing_deadline AS fBillingDeadline,
- wi.f_inventory_days AS fInventoryDays,
- wi.f_billing_days AS fBillingDays,
- w.f_remarks AS fRemarks
- FROM t_fee_do w
- LEFT JOIN t_warehousebillsfees wi ON w.f_srcid = wi.f_id
- LEFT JOIN t_fees f ON wi.f_feeid = f.f_id
- LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_feeUnitid
- , (
- SELECT @ii := 0
- ) AS ii
- WHERE dict.status = '0'
- AND dict.dict_type = 'data_unitfees'
- AND w.f_pid = #{fId}
- </select>
- <select id="warehouseBillsFeesProfitList" resultType="java.util.Map">
- SELECT
- t.f_id AS fSrcpid,
- c.f_name AS fName,
- c1.f_name AS fFeesName,
- w.f_mblno AS fMblno,
- w.f_product_name AS fProductName,
- u1.user_name AS fSalesmanName,
- w.f_marks AS fMarks,
- t.f_billtype AS fBilltype,
- w.f_review_date AS fReviewDate,
- sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) fAmount,
- sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) fStlamount,
- sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) - sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END )
- nnfinished
- FROM
- t_warehousebillsfees w
- LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
- left join sys_user u on t.create_by = u.user_name
- left join sys_user u1 on t.f_salesman_id = u1.user_id
- left join sys_dept d on t.f_bsdeptid = d.dept_id
- LEFT JOIN t_corps c ON c.f_id = t.f_corpid
- LEFT JOIN t_corps c1 ON c1.f_id = w.f_corpid
- <where>
- <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
- <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
- <if test="fDeptId != null and fDeptId != ''">and t.f_bsdeptid = #{fDeptId}</if>
- <if test="fSalesmanId != null and fSalesmanId != ''">and t.f_salesman_id = #{fSalesmanId}</if>
- <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
- <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
- <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',
- #{fProductName}, '%')
- </if>
- <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>
- and w.f_billstatus != 6
- </if>
- <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
- and w.f_billstatus = 6
- </if>
- <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
- and w.f_review_date >= #{timeExamine[0]}
- </if>
- <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
- and w.f_review_date <= #{timeExamine[1]}
- </if>
- <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
- and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
- </if>
- <if test="fBusinessType != null and fBusinessType != '' ">
- and w.f_business_type in
- <foreach collection="fBusinessType" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </if>
- <if test="fFeeid != null and fFeeid != '' ">
- and w.f_feeid in
- <foreach collection="fFeeid" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </if>
- and w.f_review_date IS NOT NULL
- ${params.dataScope}
- GROUP BY
- w.f_mblno
- </where>
- </select>
- <select id="warehouseBillsFeesCustomProfitList" resultType="java.util.Map">
- SELECT
- c.f_name AS fName,
- c.f_id AS fCorpid,
- DATE_FORMAT(w.f_review_date,'%Y-%m') AS reviewDate,
- DATE_FORMAT(t.f_bstime,'%Y-%m') AS f_bstime,
- sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) fAmount,
- sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) fStlamount,
- sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) - sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) nnfinished
- FROM
- t_warehousebillsfees w
- LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
- left join sys_user u on t.create_by = u.user_name
- left join sys_user u1 on t.f_salesman_id = u1.user_id
- left join sys_dept d on t.f_bsdeptid = d.dept_id
- LEFT JOIN t_corps c ON c.f_id = t.f_corpid
- LEFT JOIN t_corps c1 ON c1.f_id = w.f_corpid
- <where>
- <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
- <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
- <if test="fDeptId != null and fDeptId != ''">and t.f_bsdeptid = #{fDeptId}</if>
- <if test="fSalesmanId != null and fSalesmanId != ''">and t.f_salesman_id = #{fSalesmanId}</if>
- <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
- <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
- <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',#{fProductName}, '%')</if>
- <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>and w.f_billstatus != 6</if>
- <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>and w.f_billstatus = 6</if>
- <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
- and DATE_FORMAT(w.f_review_date, '%Y-%m') between #{timeExamine[0]} and #{timeExamine[1]}
- </if>
- <if test="fBstimeExamine != null and fBstimeExamine[0] != null and fBstimeExamine[0]!= ''">
- and DATE_FORMAT(t.f_bstime, '%Y-%m') between #{fBstimeExamine[0]} and #{fBstimeExamine[1]}
- </if>
- <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
- and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
- </if>
- <if test="fBusinessType != null and fBusinessType != '' ">
- and w.f_business_type in
- <foreach collection="fBusinessType" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </if>
- <if test="fFeeid != null and fFeeid != '' ">
- and w.f_feeid in
- <foreach collection="fFeeid" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </if>
- and w.f_review_date IS NOT NULL
- ${params.dataScope}
- </where>
- GROUP BY
- c.f_name,
- reviewDate
- </select>
- <select id="selectFeeList" resultType="java.util.Map">
- select
- ware.create_by AS createBy,
- ware.f_billno AS fBillno,
- ware.f_ctrlcorpid AS fCtrlcorpid,
- ware.create_time AS createTime,
- ware.f_accbilldate AS fAccbilldate,
- ware.t_mblno AS tMblno,
- dic.dict_label AS chargingMethod,
- ware.invoice_no AS invoiceNo,
- ware.bank AS bank,
- ware.water_bill_no AS waterBillNo,
- ware.f_amtdr AS fAmtdr,
- ware.f_amtcr AS fAmtcr,
- ware.f_remarks AS fRemarks,
- CASE
- WHEN ware.f_billstatus = '1' THEN '新建'
- WHEN ware.f_billstatus = '2' THEN '暂存'
- WHEN ware.f_billstatus = '3' THEN '审批驳回'
- WHEN ware.f_billstatus = '4' THEN '提交审核'
- WHEN ware.f_billstatus = '5' THEN '审核中'
- WHEN ware.f_billstatus = '6' THEN '审核完成'
- END
- AS fBillstatus
- from
- t_fee ware
- left join sys_user u on ware.create_by = u.user_name
- left join sys_dept d on ware.f_deptid = d.dept_id
- LEFT JOIN (
- SELECT *
- FROM sys_dict_data dic
- WHERE
- dic.dict_label =
- IF(
- (dic.`status`='0' AND dic.dict_type = 'data_settlement_type')
- ,dic.dict_label,NULL)
- ) dic ON dic.dict_value = ware.charging_method
- <where>
- <if test="fBillno != null and fBillno != ''">and ware.f_billno = #{fBillno}</if>
- <if test="fCtrlcorpid != null ">and ware.f_ctrlcorpid = #{fCtrlcorpid}</if>
- <if test="fActId != null ">and ware.f_act_id = #{fActId}</if>
- <if test="fCorpid != null ">and ware.f_corpid = #{fCorpid}</if>
- <if test="fTransActId != null ">and ware.f_trans_act_id = #{fTransActId}</if>
- <if test="tMblno != null and tMblno != ''">and ware.t_mblno = #{tMblno}</if>
- <if test="fAmtdr != null ">and ware.f_amtdr = #{fAmtdr}</if>
- <if test="fAmtcr != null ">and ware.f_amtcr = #{fAmtcr}</if>
- <if test="fBilltype != null and fBilltype != ''">and ware.f_billtype = #{fBilltype}</if>
- <if test="fBillstatus != null and fBillstatus != ''">and ware.f_billstatus = #{fBillstatus}</if>
- <if test="fRemarks != null and fRemarks != ''">and ware.f_remarks = #{fRemarks}</if>
- <if test="fFromDate != null ">and ware.f_from_date = #{fFromDate}</if>
- <if test="fAccbilldate != null ">and ware.f_accbilldate = #{fAccbilldate}</if>
- <if test="fToDate != null ">and ware.f_to_date = #{fToDate}</if>
- <if test="fRefNo != null and fRefNo != ''">and ware.f_ref_no = #{fRefNo}</if>
- <if test="fDeptid != null ">and ware.f_deptid = #{fDeptid}</if>
- <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
- and ware.f_accbilldate >= #{timeInterval[0]}
- </if>
- <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
- and ware.f_accbilldate <= #{timeInterval[1]}
- </if>
- <if test="chargingMethod != null ">and ware.charging_method = #{chargingMethod}</if>
- <if test="invoiceNo != null ">and ware.invoice_no = #{invoiceNo}</if>
- <if test="bank != null ">and ware.bank = #{bank}</if>
- <if test="waterBillNo != null ">and ware.water_bill_no = #{waterBillNo}</if>
- </where>
- ${params.dataScope}
- </select>
- <select id="selectDetailedList" resultType="com.ruoyi.finance.excel.Detailed">
- SELECT (@ii := @ii + 1) AS fId,
- wi.f_mblno AS fMblno,
- wi.f_bsdate AS fBsdate,
- t.f_bscorpno AS fBscorpno,
- f.f_name AS fFeeid,
- CASE
- WHEN w.f_srcdc = 'D' THEN
- '收'
- WHEN w.f_srcdc = 'C' THEN
- '付'
- END AS fSrcdc,
- w.f_amtdr AS fAmtdr,
- dict.dict_label AS fFeeunitid,
- wi.f_qty AS fBillingQty,
- wi.f_unitprice AS fUnitprice,
- w.f_amt AS fAmt,
- wi.f_business_type AS fBusinessType,
- CASE
- wi.f_billtype
- WHEN 'SJRK' THEN
- '入库'
- WHEN 'SJCK' THEN
- '出库'
- WHEN 'HQZY' THEN
- '货转'
- WHEN 'CKDB' THEN
- '调拨'
- WHEN 'HWTG' THEN
- '货物通关'
- WHEN 'KCZZ' THEN
- '库存总账'
- END AS fBilltype,
- wi.f_product_name AS fGoodsid,
- wi.f_marks AS fMarks,
- w.f_remarks AS fRemarks
- FROM t_fee_do w
- LEFT JOIN t_warehousebillsfees wi ON w.f_srcid = wi.f_id
- LEFT JOIN t_warehousebills t ON wi.f_pid = t.f_id
- LEFT JOIN t_fees f ON wi.f_feeid = f.f_id
- LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_feeUnitid
- , (
- SELECT @ii := 0
- ) AS ii
- WHERE dict.status = '0'
- AND dict.dict_type = 'data_unitfees'
- AND w.f_pid = #{fId}
- </select>
- <select id="selectDetailedList1" resultType="java.util.Map">
- SELECT t.f_id AS fSrcpid,
- t.f_corpid AS fCorpid,
- c.f_name AS fName,
- c1.f_name AS fFeesName,
- w.f_mblno AS fMblno,
- w.f_product_name AS fProductName,
- w.f_marks AS fMarks,
- w.f_dc AS fSrcdc,
- w.f_amount AS fAmount,
- w.f_stlamount AS fStlamount,
- ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) AS nnfinished
- FROM t_warehousebills t
- LEFT JOIN sys_user u ON t.create_by = u.user_name
- LEFT JOIN sys_dept d ON t.f_bsdeptid = d.dept_id
- LEFT JOIN t_corps c ON c.f_id = t.f_corpid
- LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
- LEFT JOIN t_corps c1 ON w.f_corpid = c1.f_id
- LEFT JOIN t_fees f ON w.f_feeid = f.f_id
- WHERE w.f_dc = #{fSrcdc}
- AND t.f_review_date IS NOT NULL
- AND w.f_corpid = #{fCorpIds}
- AND t.f_corpid = #{fCorpId}
- AND w.f_mblno = #{fMblno}
- </select>
- <!--网页版发票申请查询-->
- <select id="webVersionInvoice" parameterType="TFee" resultType="java.util.Map">
- SELECT
- tf.f_id AS fId,/**费用主表id*/
- tf.f_billno AS fBillno,/**费用申请编号*/
- tf.f_ctrlcorpid AS fCtrlcorpid,/**货权方*/
- tf.f_corpid AS fCorpid,/**结算单位*/
- tc.f_name AS fCorpidName,/**结算单位中文名称*/
- tf.t_mblno AS tMblno,/**提单号*/
- tf.f_amtdr AS fAmtdr,/**应收合计*/
- tf.f_amtcr AS fAmtcr,/**应付合计*/
- tf.f_billtype AS fBilltype,/**业务类型*/
- tf.f_billstatus AS fBillstatus,/**状态*/
- CASE
- WHEN tf.f_billstatus = '1' THEN
- '新建'
- WHEN tf.f_billstatus = '2' THEN
- '暂存'
- WHEN tf.f_billstatus = '3' THEN
- '驳回'
- WHEN tf.f_billstatus = '4' THEN
- '提交'
- WHEN tf.f_billstatus = '5' THEN
- '审批中'
- WHEN tf.f_billstatus = '6' THEN
- '审批通过'
- END AS fBillstatusName,
- tf.f_remarks AS fRemarks,/**备注*/
- tf.f_accbilldate AS fAccbilldate,/**结算日期*/
- tf.create_by AS createBy,/**创建人*/
- tf.create_time AS createTime,/**创建时间*/
- tf.update_by AS updateBy,/**更新人*/
- tf.update_time AS updateTime,/**更新时间*/
- tf.invoice_no AS invoiceNo,/**发票号*/
- tf.bank AS bank,/**银行*/
- tf.water_bill_no AS waterBillNo,/**水单号*/
- tf.f_system_type AS fSystemType,/**系统类型*/
- tf.f_tracking_number AS fTrackingNumber,/**快递单号*/
- tf.f_invoice_rise AS fInvoiceRise,/**发票抬头*/
- tf.f_sign AS fSign,/**是否签收*/
- tf.f_send_Time AS fSendTime,/**寄送时间*/
- tf.charging_method AS chargingMethod,/**收费方式*/
- pro.dict_label AS chargingMethodName /**收费方式中文名称*/
- FROM
- t_fee tf
- LEFT JOIN t_corps tc ON tf.f_corpid = tc.f_id
- LEFT JOIN sys_dict_data pro ON pro.dict_value = tf.charging_method
- AND pro.dict_type = 'data_settlement_type'
- WHERE tf.f_billtype = 'ApplyFP'
- <if test="createBy != null and createBy != ''">and tf.create_by = #{createBy}</if>
- <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
- and tf.create_time >= #{timeInterval[0]}
- </if>
- <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
- and tf.create_time <= #{timeInterval[1]}
- </if>
- <if test="invoiceNo != null and invoiceNo != ''">and tf.invoice_no like concat('%', #{invoiceNo}, '%')</if>
- <if test="fInvoiceRise != null and fInvoiceRise != ''">and tf.f_invoice_rise like concat('%', #{fInvoiceRise},
- '%')
- </if>
- <if test="fBillno != null and fBillno != ''">and tf.f_billno like concat('%', #{fBillno}, '%')</if>
- <if test="fBillstatus != null and fBillstatus != '' and fBillstatus != 'null' ">and tf.f_billstatus =
- #{fBillstatus}
- </if>
- ORDER BY tf.f_id desc
- </select>
- <!--凯和检索费用信息-->
- <select id="FinancialFeesList" resultType="java.util.Map">
- SELECT
- w.f_id AS fSrcid,
- t.f_id AS fSrcpid,
- w.f_corpid AS fCorpid,
- w.fName AS fName,
- t.f_mblno AS fMblno,
- w.f_bsdate AS fBsdate,
- t.f_billtype AS fBilltype,
- t.f_review_date AS fReviewDate,
- w.f_feeid AS fFeeid,
- w.src_bill_no AS srcBillNo,
- w.f_marks AS fMarks,
- f.f_name AS fFeeName,
- w.f_dc AS fSrcdc,
- w.f_qty AS fQty,
- w.f_unitprice AS fUnitPrice,
- w.f_amount AS fAmount,
- w.f_feeUnitid AS fFeeUnitId,
- pr.dict_label AS fFeeUnitName,
- t.f_vslid AS fVslid,
- t.f_voyid AS fVoyid,
- tv.f_name AS fvslName,
- ty.f_no AS fvoyName,
- tre.f_name AS fLoadPortName,
- ts.f_name As fDestPortName,
- w.f_billstatus AS fBillStatus,
- t.f_loadportid AS fLoadportid,
- t.f_destportid AS fDestportid,
- tn.f_name AS cntrName,
- ti.f_cntrcount AS fCntrCount,
- <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHDZ" '>
- ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmtdr,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_accamount, 0 ) AS fAmt,
- </if>
- <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHSF" '>
- ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
- </if>
- <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHFF" '>
- ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmtdr,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS fAmt,
- </if>
- CASE
- WHEN w.f_dc = 'D' THEN '收'
- WHEN w.f_dc = 'C' THEN '付'
- END AS fSrcdcName,
- CASE
- WHEN w.f_billstatus = '1' THEN '新建'
- WHEN w.f_billstatus = '2' THEN '暂存'
- WHEN w.f_billstatus = '3' THEN '驳回'
- WHEN w.f_billstatus = '4' THEN '提交'
- WHEN w.f_billstatus = '5' THEN '审批中'
- WHEN w.f_billstatus = '6' THEN '通过'
- END AS fBillStatusName,
- tg.f_name AS goodName
- FROM
- t_warehousebills t
- LEFT JOIN (
- SELECT
- f.f_id AS f_id,
- f.f_pid AS f_pid,
- f.f_lineno AS f_lineno,
- f.f_corpid,
- f.f_feeid,
- f.f_feeUnitid,
- f.f_qty,
- f.f_unitprice,
- f.f_amount,
- f.f_currency,
- f.f_exrate,
- f.f_taxrate,
- f.f_dc,
- f.f_billstatus,
- f.f_statement_no,
- f.f_accamount,
- f.f_accamount_date,
- f.f_stlamount_no,
- f.f_stlamount,
- f.f_stlamount_date,
- f.f_invnos,
- f.f_invamount,
- f.f_askamount,
- f.f_chargedate,
- f.f_status,
- f.remark,
- f.f_mblno,
- f.f_product_name,
- f.src_bill_no,
- f.f_billing_days,
- f.f_inventory_days,
- f.f_marks,
- f.f_billing_deadline,
- f.f_originalbilldate,
- f.f_billtype,
- f.f_business_type,
- f.f_bsdate,
- c.f_id AS fId,
- c.f_name AS fName
- FROM
- t_warehousebillsfees AS f
- LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
- ) w ON w.f_pid = t.f_id
- LEFT JOIN t_fees f ON w.f_feeid = f.f_id
- LEFT JOIN sys_dict_data pr ON pr.dict_value = w.f_feeUnitid
- AND pr.dict_type = 'data_unitfees'
- LEFT JOIN t_vessel tv ON t.f_vslid = tv.f_id
- LEFT JOIN t_voyage ty ON t.f_voyid = ty.f_id
- LEFT JOIN t_address tre ON tre.f_id = t.f_loadportid
- LEFT JOIN t_address ts ON ts.f_id = t.f_destportid
- LEFT JOIN t_warehousebills_cntr ti ON ti.f_pid = t.f_id
- LEFT JOIN t_cntr tn ON tn.f_id = ti.f_cntrid
- LEFT JOIN t_goods tg ON ti.f_goodsid = tg.f_id
- <where>
- t.f_typeid = 1
- and w.f_billstatus = 6
- <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
- #{map.tWareHouseFees.fCorpid}
- </if>
- <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
- and w.f_accamount_date IS NOT NULL
- </if>
- <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
- and w.f_accamount_date IS NULL
- </if>
- <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and t.f_mblno like
- concat('%', #{map.tWareHouseFees.fMblno}, '%')
- </if>
- <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != ""'>
- and w.f_dc = #{map.tWareHouseFees.fDc}
- </if>
- <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
- w.f_statement_no = #{map.tWareHouseFees.fStatementNo}
- </if>
- <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
- </if>
- <if test="map.tWareHouseFees.fVslid != null">and t.f_vslid = #{map.tWareHouseFees.fVslid}</if>
- <if test="map.tWareHouseFees.fVoyid != null">and t.f_voyid = #{map.tWareHouseFees.fVoyid}</if>
- <if test="map.tWareHouseFees.fLoadportid != null ">and t.f_loadportid = #{map.tWareHouseFees.fLoadportid}
- </if>
- <if test="map.tWareHouseFees.fDestportid != null ">and t.f_destportid = #{map.tWareHouseFees.fDestportid}
- </if>
- <if test="map.tWareHouseFees.fFromDate != null ">and ty.f_ATD >= #{map.tWareHouseFees.fFromDate}</if>
- <if test="map.tWareHouseFees.fToDate != null ">and ty.f_ATD <= #{map.tWareHouseFees.fToDate}</if>
- <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHDZ" '>
- and abs(ifnull(w.f_amount, 0) - ifnull(w.f_accamount, 0)) > 0
- </if>
- <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHSF" '>
- and abs(ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0)) > 0
- </if>
- <if test='map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype != "" and map.tWareHouseFees.fBilltype == "KHFF" '>
- and abs(ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0)) > 0
- </if>
- GROUP BY w.f_id
- </where>
- </select>
- <!--凯和查询财务主表数据-->
- <select id="selectFinancialTFeeId" parameterType="TFee" resultType="com.ruoyi.finance.shipping.FinancialTFee">
- SELECT
- f.f_id AS fId,
- f.f_billno AS fBillno,
- f.f_ctrlcorpid AS fCtrlcorpid,
- pro.dict_label AS chargingMethod,
- f.invoice_no AS invoiceNo,
- f.bank AS fBank,
- f.water_bill_no AS waterBillNo,
- f.f_corpid AS fCorpid,
- c.f_name AS fCorpidName,
- f.f_accbilldate AS fAccbilldate,
- f.t_mblno AS tMblno,
- f.f_amtdr AS fAmtdr,
- f.f_amtcr AS fAmtcr,
- f.f_billtype AS fBilltype,
- f.f_system_type AS fSystemType,
- f.f_billstatus AS fBillstatus,
- CASE
- WHEN f.f_billstatus = '1' THEN '新建'
- WHEN f.f_billstatus = '2' THEN '暂存'
- WHEN f.f_billstatus = '3' THEN '审批驳回'
- WHEN f.f_billstatus = '4' THEN '提交审核'
- WHEN f.f_billstatus = '5' THEN '审核中'
- WHEN f.f_billstatus = '6' THEN '审核完成'
- END
- AS fBillstatusName,
- f.f_remarks AS fRemarks,
- f.create_by AS createBy,
- f.create_time AS createTime,
- f.update_by AS updateBy,
- f.update_time AS updateTime,
- tv.f_name AS vessel,
- ty.f_no AS voyage,
- tre.f_name AS loadportName,
- ts.f_name AS destportName,
- f.f_bank_number AS fBankNumber,
- f.bank AS bank,
- f.invoice_remarks AS invoiceRemarks,
- f.f_loadportid AS fLoadportid,
- f.f_destportid AS fDestportid,
- f.f_billno AS srcBillNo,
- CASE
- WHEN f.f_dc = 'D' THEN
- '收'
- WHEN f.f_dc = 'C' THEN
- '付'
- END AS fSrcdcName,
- f.f_vslid AS fVslid,
- f.f_voyid AS fVoyid,
- f.f_from_date AS fFromDate,
- f.f_to_date AS fToDate,
- f.f_reconciliation AS fReconciliation,
- f.f_dc AS fDc
- FROM
- t_fee AS f
- LEFT JOIN t_corps AS c ON f.f_corpid = c.f_id
- LEFT JOIN sys_dict_data pro ON pro.dict_value = f.charging_method and pro.dict_type = 'data_settlement_type'
- LEFT JOIN t_vessel tv ON f.f_vslid = tv.f_id
- LEFT JOIN t_voyage ty ON f.f_voyid = ty.f_id
- LEFT JOIN t_address tre ON tre.f_id = f.f_loadportid
- LEFT JOIN t_address ts ON ts.f_id = f.f_destportid
- where
- f.f_id = #{fId}
- </select>
- <select id="exportFinancial" parameterType="TFee" resultType="com.ruoyi.shipping.excel.ExportFinancial">
- SELECT
- @rank:=@rank + 1 AS rankNo,
- tp.fMblNo AS fMblNo,
- tp.portOfDeparture AS portOfDeparture,
- tp.destinationPort AS destinationPort,
- tp.goodName AS goodName,
- IFNULL(tp.fCnTrCount,0) AS fCnTrCount,
- tp.specification AS specification,
- ROUND(IFNULL(tp.fUnitPrice,0),2) AS fUnitPrice,
- ROUND(IFNULL(tp.fAmount,0),2) AS fAmount,
- tp.fServiceitems AS fServiceitems,
- tp.fServiceitemsNew AS fServiceitemsNew
- FROM
- (
- SELECT
- tw.f_mblno AS fMblNo,
- ts.f_name AS portOfDeparture,
- ty.f_name AS destinationPort,
- tg.f_name AS goodName,
- IFNULL(temp.fCnTrCount,0) AS fCnTrCount,
- tr.f_name AS specification,
- CASE
- WHEN temp.fCnTrCount != 0 THEN temp.fAmount/temp.fCnTrCount
- ELSE 0
- END AS fUnitPrice,
- IFNULL(temp.fAmount,0) AS fAmount,
- sd.dict_label fServiceitems,
- si.dict_label fServiceitemsNew
- FROM
- (
- SELECT
- td.f_srcpid AS pId,
- IFNULL(tr.f_cntrcount,0) AS fCnTrCount,
- IFNULL(SUM(td.f_amt),0) AS fAmount
- FROM
- t_fee_do td
- LEFT JOIN
- t_warehousebills tw ON tw.f_id = td.f_srcpid
- LEFT JOIN t_warehousebills_cntr tr ON tr.f_pid = tw.f_id
- WHERE td.f_pid = #{id}
- GROUP BY td.f_srcpid
- )temp
- LEFT JOIN t_warehousebills tw ON tw.f_id = temp.pId
- LEFT JOIN t_address ts ON tw.f_loadportid = ts.f_id
- LEFT JOIN t_address ty ON tw.f_destportid = ty.f_id
- LEFT JOIN t_warehousebills_cntr tc ON tc.f_pid = tw.f_id
- LEFT JOIN t_cntr tr ON tr.f_id = tc.f_cntrid
- LEFT JOIN t_goods tg ON tc.f_goodsid = tg.f_id
- LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems AND sd.dict_type = 'f_serviceitems'
- LEFT JOIN sys_dict_data si ON si.dict_value = tw.f_serviceitems_new AND si.dict_type = 'f_serviceitemsNew'
- )tp,
- (SELECT @rank:= 0) b
- </select>
- <select id="receivable" resultType="com.ruoyi.finance.shipping.ReceivableExcel">
- SELECT
- DISTINCT
- tv.f_name AS shipsName,#船名
- ty.f_no AS voyage,# 航次
- tc.f_name AS unitOfAccount,#结算单位
- tw.f_mblno AS blNo,#提单号
- ta.f_name AS portOfLoading,#起运港
- td.f_name AS destination,#目的港
- ty.f_ATD sailingDate,#开船日期
- tf.f_review_date AS auditDate,#审核日期
- ROUND(IFNULL(SUM(f_amount),0),2) AS receivable, #应收金额
- ROUND(IFNULL(SUM(f_stlamount),0),2) AS handle,#实收金额
- ROUND((IFNULL(SUM(f_amount),0)-IFNULL(SUM(f_stlamount),0)),2) AS profit #未收金额
- FROM
- t_warehousebillsfees tf
- LEFT JOIN t_warehousebills tw ON tf.f_pid = tw.f_id
- LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
- LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
- LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
- LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
- LEFT JOIN t_address td ON td.f_id = tw.f_destportid
- <where>
- tf.f_dc = #{fDc}
- and tw.f_typeid = 1
- and tw.del_flag = '0'
- <if test="fMblno != null and fMblno != ''">and tw.f_mblno like concat('%', #{fMblno}, '%')</if>
- <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
- <if test="fCorpid != null">and tf.f_corpid = #{fCorpid}</if>
- <if test="fVoyid != null">and tw.f_voyid = #{fVoyid}</if>
- <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
- <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
- <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
- and tf.f_billstatus != 6
- </if>
- <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "2" '>
- and tf.f_billstatus = 6
- </if>
- <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
- and tf.f_review_date >= #{timeExamine[0]}
- </if>
- <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
- and tf.f_review_date <= #{timeExamine[1]}
- </if>
- <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
- and ty.f_ATD >= #{timeInterval[0]}
- </if>
- <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
- and ty.f_ATD <= #{timeInterval[1]}
- </if>
- GROUP BY tw.f_mblno,tf.f_corpid
- ORDER BY tw.f_bsdate DESC
- </where>
- </select>
- <select id="profit" resultType="com.ruoyi.finance.shipping.ProfitExcel">
- SELECT
- DISTINCT
- tv.f_name AS shipsName,
- ty.f_no AS voyage,
- ty.f_atd AS atd,
- ROUND(sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ),2) AS receivable,
- ROUND(sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ),2) AS handle,
- ROUND((sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) - sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END )),2) AS profit,
- ROUND(sum( CASE f_dc WHEN 'D' THEN f_stlamount ELSE 0 END ),2) AS actualReceivable,
- ROUND(sum( CASE f_dc WHEN 'C' THEN f_stlamount ELSE 0 END ),2) AS actualHandle
- FROM
- t_warehousebillsfees tf
- LEFT JOIN t_warehousebills tw ON tf.f_pid = tw.f_id
- LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
- LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
- <where>
- tw.f_typeid in (1, 10)
- and tw.del_flag = '0'
- <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
- <if test="fVoyid != null">and tw.f_voyid = #{fVoyid}</if>
- <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
- <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
- <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
- and tf.f_billstatus != 6
- </if>
- <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "2" '>
- and tf.f_billstatus = 6
- </if>
- <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
- and tf.f_review_date >= #{timeExamine[0]}
- </if>
- <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
- and tf.f_review_date <= #{timeExamine[1]}
- </if>
- <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
- and ty.f_ATD >= #{timeInterval[0]}
- </if>
- <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
- and ty.f_ATD <= #{timeInterval[1]}
- </if>
- GROUP BY tw.f_vslid,tw.f_voyid,ty.f_atd
- ORDER BY ty.f_atd DESC
- </where>
- </select>
- <select id="handle" resultType="com.ruoyi.finance.shipping.HandleExcel">
- SELECT
- DISTINCT
- tv.f_name AS shipsName,#船名
- ty.f_no AS voyage,# 航次
- tc.f_name AS unitOfAccount,#结算单位
- tw.f_mblno AS blNo,#提单号
- ta.f_name AS portOfLoading,#起运港
- td.f_name AS destination,#目的港
- ty.f_ATD sailingDate,#开船日期
- tf.f_review_date AS auditDate,#审核日期
- ROUND(IFNULL(SUM(f_amount),0),2) AS receivable, #应收金额
- ROUND(IFNULL(SUM(f_stlamount),0),2) AS handle,#实收金额
- ROUND((IFNULL(SUM(f_amount),0)-IFNULL(SUM(f_stlamount),0)),2) AS profit #未收金额
- FROM
- t_warehousebillsfees tf
- LEFT JOIN t_warehousebills tw ON tf.f_pid = tw.f_id
- LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
- LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
- LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
- LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
- LEFT JOIN t_address td ON td.f_id = tw.f_destportid
- <where>
- tf.f_dc = #{fDc}
- and tw.f_typeid = 1
- and tw.del_flag = '0'
- <if test="fMblno != null and fMblno != ''">and tw.f_mblno like concat('%', #{fMblno}, '%')</if>
- <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
- <if test="fCorpid != null">and tf.f_corpid = #{fCorpid}</if>
- <if test="fVoyid != null">and tw.f_voyid = #{fVoyid}</if>
- <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
- <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
- <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>
- and tf.f_billstatus != 6
- </if>
- <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "2" '>
- and tf.f_billstatus = 6
- </if>
- <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
- and tf.f_review_date >= #{timeExamine[0]}
- </if>
- <if test='timeExamine != null and timeExamine[1] != null and timeExamine[1]!= ""'>
- and tf.f_review_date <= #{timeExamine[1]}
- </if>
- <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
- and ty.f_ATD >= #{timeInterval[0]}
- </if>
- <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
- and ty.f_ATD <= #{timeInterval[1]}
- </if>
- GROUP BY tw.f_mblno,tf.f_corpid
- ORDER BY tw.f_bsdate DESC
- </where>
- </select>
- <select id="queryApplyInvoiceFeesList" resultType="java.util.Map">
- SELECT
- w.f_id AS fSrcid,
- t.f_id AS fSrcpid,
- t.f_corpid AS fCorpid,
- c.f_name AS fName,
- c.f_name AS fFeesName,
- t.f_bscorpno AS fBscorpno,
- t.f_billno as fBillno,
- w.f_mblno AS fMblno,
- w.f_product_name AS fProductName,
- w.f_bsdate AS fBsdate,
- t.f_billtype AS fBilltype,
- t.f_review_date AS fReviewDate,
- w.f_marks AS fMarks,
- w.f_feeid AS fFeeid,
- w.f_billtype AS fBilltype,
- w.f_chargedate AS fChargedate,
- w.f_originalbilldate AS fOriginalbilldate,
- w.f_billing_deadline AS fBillingDeadline,
- w.f_billing_days AS fBillingDays,
- w.f_inventory_days AS fInventoryDays,
- f.f_name AS fFeeName,
- w.f_dc AS fSrcdc,
- CASE
- WHEN w.f_dc = 'D' THEN
- '收'
- WHEN w.f_dc = 'C' THEN
- '付'
- END AS fSrcdcName,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmtdr,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_invamount, 0 ) AS fAmt,
- dict.dict_label AS fFeeunitid,
- w.f_qty AS fQty,
- w.f_unitprice AS fUnitprice,
- w.f_business_type AS fBusinessType,
- w.remark AS fRemarks
- FROM
- t_warehousebillsfees w
- LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
- LEFT JOIN t_corps c ON c.f_id = w.f_corpid
- LEFT JOIN t_fees f ON w.f_feeid = f.f_id
- LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_feeUnitid
- <where>
- dict.status = '0'
- AND dict.dict_type = 'data_unitfees'
- <if test="map.tWareHouseFees.stlTypeid != null">and w.f_stltypeid = #{map.tWareHouseFees.stlTypeid}</if>
- <if test="map.tWareHouseFees.fCorpid != null and map.tWareHouseFees.fCorpid != ''">and w.f_corpid =
- #{map.tWareHouseFees.fCorpid}
- </if>
- <if test="map.tWareHouseFees.fTypeid != null ">and t.f_typeid = #{map.tWareHouseFees.fTypeid}</if>
- <if test="map.tWareHouseFees.fTypeid == null ">and t.f_typeid IS NULL</if>
- <if test="map.tWareHouseFees.fToCorpid != null and map.tWareHouseFees.fToCorpid != ''">and w.f_corpid =
- #{map.tWareHouseFees.fToCorpid}
- </if>
- <if test="map.tWareHouseFees.fMblno != null and map.tWareHouseFees.fMblno != ''">and w.f_mblno like
- concat('%', #{map.tWareHouseFees.fMblno}, '%')
- </if>
- <if test="map.tWareHouseFees.fStatementNo != null and map.tWareHouseFees.fStatementNo != ''">and
- w.f_statement_no like concat('%', #{map.tWareHouseFees.fStatementNo}, '%')
- </if>
- <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "1" '>
- and w.f_accamount_date IS NOT NULL
- </if>
- <if test='map.tWareHouseFees.fReconciliation != null and map.tWareHouseFees.fReconciliation != "" and map.tWareHouseFees.fReconciliation == "0" '>
- and w.f_accamount_date IS NULL
- </if>
- <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "D" '>
- and w.f_dc = #{map.tWareHouseFees.fDc}
- </if>
- <if test='map.tWareHouseFees.fDc != null and map.tWareHouseFees.fDc != "" and map.tWareHouseFees.fDc == "C" '>
- and w.f_dc = #{map.tWareHouseFees.fDc}
- </if>
- <if test="map.tWareHouseFees.fFeeid != null and map.tWareHouseFees.fFeeid != '' ">
- and w.f_feeid in
- <foreach collection="map.tWareHouseFees.fFeeid" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[0] != null and map.tWareHouseFees.timeExamine[0]!= ""'>
- and w.f_review_date >= #{map.tWareHouseFees.timeExamine[0]}
- </if>
- <if test='map.tWareHouseFees.timeExamine != null and map.tWareHouseFees.timeExamine[1] != null and map.tWareHouseFees.timeExamine[1]!= ""'>
- and w.f_review_date <= #{map.tWareHouseFees.timeExamine[1]}
- </if>
- <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[0] != null and map.tWareHouseFees.timeInterval[0]!= ""'>
- and w.f_bsdate >= #{map.tWareHouseFees.timeInterval[0]}
- </if>
- <if test='map.tWareHouseFees.timeInterval != null and map.tWareHouseFees.timeInterval[1] != null and map.tWareHouseFees.timeInterval[1]!= ""'>
- and w.f_bsdate <= #{map.tWareHouseFees.timeInterval[1]}
- </if>
- <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[0] != null and map.tWareHouseFees.timeReconci[0]!= ""'>
- and w.f_accamount_date >= #{map.tWareHouseFees.timeReconci[0]}
- </if>
- <if test='map.tWareHouseFees.timeReconci != null and map.tWareHouseFees.timeReconci[1] != null and map.tWareHouseFees.timeReconci[1]!= ""'>
- and w.f_accamount_date <= #{map.tWareHouseFees.timeReconci[1]}
- </if>
- <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJRK'">
- and w.f_billtype = #{map.tWareHouseFees.fBilltype}
- </if>
- <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'SJCK'">
- and w.f_billtype = #{map.tWareHouseFees.fBilltype}
- </if>
- <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'HQZY'">
- and w.f_billtype = #{map.tWareHouseFees.fBilltype}
- </if>
- <if test="map.tWareHouseFees.fBilltype != null and map.tWareHouseFees.fBilltype == 'KHDD'">
- and w.f_billtype = #{map.tWareHouseFees.fBilltype}
- </if>
- <if test="map.tWareHouseFees.fBusinessType != null and map.tWareHouseFees.fBusinessType != '' ">
- and w.f_business_type in
- <foreach collection="map.tWareHouseFees.fBusinessType" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fSrcidList != null and map.tWareHouseFees.fSrcidList != '' ">
- and w.f_id in
- <foreach collection="map.tWareHouseFees.fSrcidList" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fSrcpidList != null and map.tWareHouseFees.fSrcpidList != '' ">
- and t.f_id in
- <foreach collection="map.tWareHouseFees.fSrcpidList" item="id" index="index" open="(" close=")"
- separator=",">
- #{id}
- </foreach>
- </if>
- <if test="map.tWareHouseFees.fBillstatus != null">and w.f_billstatus = #{map.tWareHouseFees.fBillstatus}
- </if>
- <if test='map.tWareHouseFees.createBy != null and map.tWareHouseFees.createBy != ""'>
- and w.create_by = #{map.tWareHouseFees.createBy}
- </if>
- and w.f_review_date IS NOT NULL
- and abs(IFNULL(w.f_amount, 0) - IFNULL(w.f_invamount, 0)) > 0
- GROUP BY w.f_id
- </where>
- </select>
- <select id="selectFinancialLedgerList" resultMap="feeVOResult">
- SELECT
- c.f_name AS f_fees_name, w.f_corpid, w.f_mblno, w.f_billstatus, DATE_FORMAT(w.f_review_date,'%Y-%m') AS reviewDate,DATE_FORMAT(t.f_bstime,'%Y-%m') AS f_bstime,
- SUM( w.f_amount ) AS f_amount, SUM( w.f_stlamount ) AS f_stlamount,SUM( w.f_accamount ) AS f_accamount,SUM( w.f_invamount ) AS f_invamount,
- ifnull( SUM( w.f_amount ), 0 ) - ifnull( SUM( w.f_stlamount ), 0 ) AS nnfinished
- FROM
- t_warehousebills t
- LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
- LEFT JOIN sys_user u ON t.create_by = u.user_name
- LEFT JOIN sys_dept d ON t.f_bsdeptid = d.dept_id
- LEFT JOIN t_corps c ON c.f_id = w.f_corpid
- LEFT JOIN t_fees f ON w.f_feeid = f.f_id
- <where>
- w.f_dc = #{fDc}
- <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
- <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
- <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
- <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
- <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',
- #{fProductName}, '%')
- </if>
- <if test="isReviewed != null and isReviewed == 0">
- and w.f_billstatus != 6
- </if>
- <if test="isReviewed != null and isReviewed == 1">
- and w.f_billstatus = 6
- </if>
- <if test="fReconciliation!= null and fReconciliation != '' and fReconciliation == 0">
- and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
- </if>
- <if test="timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ''">
- and DATE_FORMAT(w.f_review_date, '%Y-%m') between #{timeExamine[0]} and #{timeExamine[1]}
- </if>
- <if test="fBstimeExamine != null and fBstimeExamine[0] != null and fBstimeExamine[0]!= ''">
- and DATE_FORMAT(t.f_bstime, '%Y-%m') between #{fBstimeExamine[0]} and #{fBstimeExamine[1]}
- </if>
- ${params.dataScope}
- </where>
- GROUP BY
- w.f_corpid,
- w.f_dc,
- reviewDate
- </select>
- <select id="selectFinancialLedgerDetails" resultMap="feeVOResult">
- SELECT t.f_id AS f_srcpid, c.f_name AS f_fees_name, w.f_mblno AS f_mblno,
- w.f_product_name, w.f_marks, t.f_billtype,
- w.f_review_date,w.f_accamount,w.f_invamount,
- IF ( w.f_feeid = #{feesId}, w.f_amount, 0.00 ) storage_fee,
- IF ( w.f_feeid != #{feesId}, w.f_amount, 0.00 ) other_fee,
- w.f_amount, w.f_stlamount AS fStlamount,
- ifnull( w.f_amount, 0 ) - ifnull( w.f_stlamount, 0 ) AS nnfinished,
- t.f_bstime AS fBstime
- FROM t_warehousebills t
- LEFT JOIN t_warehousebillsfees w ON w.f_pid = t.f_id
- LEFT JOIN sys_user u ON t.create_by = u.user_name
- LEFT JOIN sys_dept d ON t.f_bsdeptid = d.dept_id
- LEFT JOIN t_corps c ON c.f_id = w.f_corpid
- LEFT JOIN t_fees f ON w.f_feeid = f.f_id
- where
- t.del_flag = '0'
- <if test="fDc != null and fDc != ''">and w.f_dc = #{fDc}</if>
- <if test="fCorpId != null and fCorpId != ''">and w.f_corpid = #{fCorpId}</if>
- <if test='isReviewed != null and isReviewed == 0 '>
- and w.f_billstatus != 6
- </if>
- <if test='isReviewed != null and isReviewed == 1 '>
- and w.f_billstatus = 6
- </if>
- <if test='fAuditList != null and fAuditList[0] != null'>
- and DATE_FORMAT(w.f_review_date, '%Y-%m') BETWEEN #{fAuditList[0]} and #{fAuditList[1]}
- </if>
- <if test="fBstimeExamine != null and fBstimeExamine[0] != null and fBstimeExamine[0]!= ''">
- and DATE_FORMAT(t.f_bstime, '%Y-%m') between #{fBstimeExamine[0]} and #{fBstimeExamine[1]}
- </if>
- GROUP BY
- w.f_id
- </select>
- </mapper>
|