SELECT id.username,id.`CheckedUserName`,id.`ApprovedUserName`,if(id.IndentType='SI','STOCK INDENT','PURCHASE INDENT') IndentType, id.IndentNo,TrimZero(id.ReceiveQty) ReceiveQty,fr.`Location` AS FromLocation,fr.StoreLocationAddress FromLocationAddress,fr1.`Location` AS ToLocation, fr1.StoreLocationAddress ToLocationAddress,id.ItemName,TrimZero(IF(approvedqty=0,`ReqQty`,approvedqty)) OrderQty,id.MinorUnitName UnitType, TrimZero(st.Rate)Rate,TrimZero(st.Rate*st.DiscountPer*0.01)DiscountPer,TrimZero((st.Rate-(st.Rate*st.DiscountPer*0.01))*TaxPerIGST*0.01)TaxPerIGST,TrimZero((st.Rate-(st.Rate*st.DiscountPer*0.01))*TaxPerCGST*0.01)TaxPerCGST,TrimZero((st.Rate-(st.Rate*st.DiscountPer*0.01))*TaxPerSGST*0.01)TaxPerSGST,TrimZero(ST.unitprice*sid.sendqty)NetAmount,(ST.unitprice*sid.sendqty) NetAmount1, fr.GSTNNO FromGSTNNo, fr1.GSTNNO ToGSTNNo, id.Narration,if(reqqty=id.rejectqty,1,0) isApproved,DATE_FORMAT(id.dtEntry,'%d/%b/%Y %I:%i %p') dtEntry, id.username EmpName ,ftm.HsnCode,ftm.CatalogNo FROM st_indent_detail id INNER JOIN st_itemmaster ftm ON id.ItemId=ftm.ItemID INNER JOIN st_locationmaster fr ON fr.`locationid`=id.`tolocationid` INNER JOIN f_panel_master fpm ON fpm.`Panel_ID`=fr.`Panel_ID` INNER JOIN centre_master cm on cm.`CentreID`=CASE WHEN fpm.`PanelType` ='Centre' then fpm.`CentreID` else fpm.tagprocessinglabid END AND fpm.`PanelType` in('Centre','PUP') and fpm.IsActive=1 INNER JOIN state_master sm ON sm.`id`=cm.`StateID` INNER JOIN st_locationmaster fr1 ON fr1.`locationid`=id.`Fromlocationid` INNER JOIN f_panel_master fpm1 ON fpm1.`Panel_ID`=fr1.`Panel_ID` INNER JOIN centre_master cm1 on cm1.`CentreID`=CASE WHEN fpm1.`PanelType` ='Centre' then fpm1.`CentreID` else fpm1.tagprocessinglabid END AND fpm1.`PanelType` in('Centre','PUP') and fpm1.IsActive=1 INNER JOIN state_master sm1 ON sm1.`id`=cm1.`StateID` inner join st_indentissuedetail sid on sid.indentno=id.indentno and sid.itemid=id.itemid inner join st_nmstock st on st.stockid=sid.stockid and st.itemid=sid.itemid WHERE id.indentno='SI-25020193' and id.IsActive=1 group by sid.itemid,st.batchnumber,st.stockid order by id.rate desc,itemname asc