Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- [Vendor].[cVenName] AS supplier_name,
- SUBSTRING ( [PO_Podetails].[cInvCode], 3, len( [PO_Podetails].[cInvCode] ) ) AS cat_no,
- [PO_Podetails].[cFree1] AS package,
- [PO_Podetails].[iQuantity] AS quantity,
- [PO_Podetails].[iSum] AS price,
- CAST ( datediff( ww, [PO_Pomain].[cAuditDate], [PO_Podetails].[dArriveDate] ) AS NVARCHAR ( MAX ) ) + '周' AS delivery,
- [PO_Pomain].[cPOID] + ( '+' + COALESCE ( [PO_Podetails].[cbMemo], '' ) ) AS remark,
- CASE
- WHEN ( [PO_Pomain_extradefine].chdefine2 LIKE '%增值%' ) THEN
- 1 ELSE 0
- END AS with_vat,
- [PO_Pomain].[cAuditDate] AS created_at, '采购订单' AS source_type, 'RMB' AS currency,
- [PO_Podetails].[ID] AS source_id,
- [UA_User].[cUser_Name] AS created_by
- FROM
- [PO_Podetails]
- JOIN [PO_Pomain] ON [PO_Pomain].[POID] = [PO_Podetails].[POID]
- JOIN [Vendor] ON [Vendor].[cVenCode] = [PO_Pomain].[cVenCode]
- JOIN [Inventory] ON [Inventory].[cInvCode] = [PO_Podetails].[cInvCode]
- JOIN [PO_Pomain_extradefine] ON [PO_Pomain].[POID] = [PO_Pomain_extradefine].[POID]
- JOIN [UA_User] ON [UA_User].[cUser_Id] = [PO_Pomain].[cPersonCode]
- WHERE
- [PO_Pomain].[cAuditDate] IS NOT NULL
- AND [Inventory].[cInvCCode] NOT LIKE '07%'
- AND ( [PO_Podetails].freceivedqty > 0 OR [PO_Podetails].[iInvQTY] > 0 )
- AND [PO_Podetails].dArriveDate > '2022-09-20'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement