Search the Blog

Tuesday, July 16, 2019

SQL Query GRN Register Complete Programming Logic and Code with Syntax

 Top 100+ Sql Server Interview Questions


 select --convert(nvarchar(20),
 convert(nvarchar(20),a.pur_voucher_no) as "GRN No.",
 convert(nvarchar,a.pur_voucher_Date,103) as "GRN Date",
 convert(nvarchar(50),d.ac_name) as "Party Name",
 convert(nvarchar(20),c.IT_NAME) as "Item Code",
 convert(nvarchar(200),c.alt_NAME) as "Item Name",
 convert(nvarchar(10),e.Para_Description) as "Unit",
po.Pur_Order_No as "PO No",
 convert(nvarchar, pom.Pur_order_date ,103) as "PO Date",
pid.Vehicle_No as "Vehicle No",
 pid.Transport_name as "Transporter Name",
 b.ALT_QTY as "@SUM@Qty",
 b.alt_rate as "Rate",
 b.final_amt as "@SUM@Amount",
 case when isnull(b.para_code,'') <> '' then
 (select name from parameter_location where co_code = b.co_Code and urn_no = b.para_code) else '' end "Location",
convert(nvarchar,DecryptByPassPhrase('key', h.ur_name ))as "Create By"
 from Purchase_GRN_det b
 left outer join Purchase_GRN_Mast a  on a.urn_no=b.URN_No
 left outer join itemmaster c on b.it_code=c.IT_CODE
 left outer join acct_mast d on a.Account_Code=d.SR_NO
 left outer join Parameter_Measurement_Unit e on c.IG_CODE=e.URN_No
 left outer join user_master h on a.co_Code = h.co_Code and a.ur_code = h.ur_code
left outer join Purchase_inward_det pim on b.from_urn_no=pim.urn_no and pim.Pur_Inward_SrNo=b.From_Item_Sr_No
 left outer join Purchase_Order_Det po on pim.from_urn_no=po.urn_no and po.Pur_Order_SrNo=pim.From_Item_Sr_No
 left outer join Purchase_Order_mast pom on po.urn_no=pom.urn_no
 left outer join Purchase_inward_mast pid on pim.urn_no=pid.urn_no
 where
 a.co_Code = @Prm_Co_Code and a.pur_voucher_Date>=@fromdate and a.pur_voucher_Date <=@todate
 and a.grn_status = 'Approved'
 order by a.URN_No

No comments:

Post a Comment

Translate