select t1.id, t1.receivable_bill_code, t1.last_receipt_plan_id, t1.last_invoice_plan_id, t1.partner_code, t1.partner_name, t1.order_code, t1.inventory_code, t1.product_type,
t1.total_price_with_tax, t1.total_price_without_tax, t1.tax_rate, t1.tax_amount, t1.received_amount, t1.unreceived_amount,
t1.invoiced_amount, t1.uninvoiced_amount, t1.create_by, t1.create_time, t1.update_by, t1.update_time, t1.remark, t1.del_flag
,t3.project_name, t3.project_code
,t4.plan_amount,t4.plan_receipt_date,
t5.plan_amount as plan_invoice_amount, t5.plan_invoice_date
from oms_receivable_bill t1
left join project_order_info t2 on t1.order_code=t2.order_code
left join project_info t3 on t2.project_id=t3.id
left join oms_receivable_receipt_plan t4 on t1.last_receipt_plan_id=t4.id
left join oms_receivable_invoice_plan t5 on t1.last_invoice_plan_id=t5.id
insert into oms_receivable_bill
receivable_bill_code,
last_receipt_plan_id,
last_invoice_plan_id,
partner_code,
partner_name,
order_code,
inventory_code,
product_type,
total_price_with_tax,
total_price_without_tax,
tax_rate,
tax_amount,
received_amount,
unreceived_amount,
invoiced_amount,
uninvoiced_amount,
create_by,
create_time,
update_by,
update_time,
remark,
#{receivableBillCode},
#{lastReceiptPlanId},
#{lastInvoicePlanId},
#{partnerCode},
#{partnerName},
#{orderCode},
#{inventoryCode},
#{productType},
#{totalPriceWithTax},
#{totalPriceWithoutTax},
#{taxRate},
#{taxAmount},
#{receivedAmount},
#{unreceivedAmount},
#{invoicedAmount},
#{uninvoicedAmount},
#{createBy},
#{createTime},
#{updateBy},
#{updateTime},
#{remark},
update oms_receivable_bill
receivable_bill_code = #{receivableBillCode},
last_receipt_plan_id = #{lastReceiptPlanId},
last_invoice_plan_id = #{lastInvoicePlanId},
partner_code = #{partnerCode},
partner_name = #{partnerName},
order_code = #{orderCode},
inventory_code = #{inventoryCode},
product_type = #{productType},
total_price_with_tax = #{totalPriceWithTax},
total_price_without_tax = #{totalPriceWithoutTax},
tax_rate = #{taxRate},
tax_amount = #{taxAmount},
received_amount = #{receivedAmount},
unreceived_amount = #{unreceivedAmount},
invoiced_amount = #{invoicedAmount},
uninvoiced_amount = #{uninvoicedAmount},
update_by = #{updateBy},
update_time = #{updateTime},
remark = #{remark},
where id = #{id}
update oms_receivable_bill set del_flag = '2' where id = #{id}
update oms_receivable_bill set del_flag = '2' where id in
#{id}
UPDATE oms_receivable_bill
invoiced_amount = #{item.invoicedAmount},
uninvoiced_amount = #{item.uninvoicedAmount},
last_invoice_plan_id = #{item.lastInvoicePlanId},
update_time = #{item.updateTime},
update_by = #{item.updateBy},
WHERE id = #{item.id}
UPDATE oms_receivable_bill
SET
last_receipt_plan_id = #{item.lastReceiptPlanId},
received_amount = #{item.receivedAmount},
unreceived_amount = #{item.unreceivedAmount},
update_time = NOW(),
update_by = #{item.updateBy}
WHERE id = #{item.id}