ALTER PROCEDURE [dbo].[sp_SaveJobCard] @DocNo NVARCHAR(100) AS BEGIN SELECT j.JobCardNo, j.JobOrderNo, j.EntryDate, j.JobCardDate, j.PromisedDate, j.ChassisNo, j.PlateNo, j.Model, j.Colour, j.Kilometer, j.CustomerCode, j.CustomerName, j.DeliveredBy, j.ContactNo, j.TimeIn, j.GuaranteePeriod, j.BillType, j.Reference, j.Status, j.Salesman, j.VehicleInfo, j.Comments, j.BranchName, j.BranchCode, j.Brand, j.Remarks, j.Year, j.GrossAmount, j.LessPerc, j.LessAmount, j.NetAmount,j.vattotal, i.itemcode,jd.ItemName,jd.ArabicName,i.CategoryName as Category,jd.Qty,jd.Unit,jd.Rate,jd.Amount,jd.VATAMT, c.Name as CustomerName,c.Vatno FROM JobCard j JOIN JobOrder jo ON jo.JobOrderNo = j.JobOrderNo JOIN JobCardDetails jd ON jd.JobCardNo= j.JobCardNo Join Item i on i.itemcode=jd.ItemCode JOIN Customer c on j.CustomerCode=c.Code WHERE j.JobCardNo = @DocNo END go ALTER PROCEDURE [dbo].[sp_SaveDeliveryNote] ( @DnNo nvarchar(50), @BranchCode varchar(10) ) AS begin select DeliveryNote.InvoiceDate as InVDate,DeliveryNote.PoDate,DeliveryNote.Del1,DeliveryNote.Del2,DeliveryNote.Del3,DeliveryNote.Del4,DeliveryNote. InvoiceNo , DeliveryNote.Attention,DeliveryNote.mobAttention,DeliveryNote.emailAttention,DeliveryNote.QuotationNo,DeliveryNote.DNNo,DeliveryNote.EntryDate, DeliveryNote.PONo,DeliveryNote.RefNo,DeliveryNote.CustomerName,DeliveryNote.CustomerCode,DeliveryNote.Address,DeliveryNote.Telephone,DeliveryNote.Fax, DeliveryNote.Attended,DeliveryNote.GrossAmount,DeliveryNote.DISAMT as Less,DeliveryNote.NetAmount,DeliveryNote.vattotal,DeliveryNoteItem.SlNo,DeliveryNoteItem.ItemCode,DeliveryNoteItem.ItemName,DeliveryNoteItem.Unit,DeliveryNoteItem.Qty,DeliveryNoteItem.OrderedQty as ORDQTY, DeliveryNoteItem.Amount,ISNULL(DeliveryNoteItem.PartNo,'') AS PartNo,ISNULL(DeliveryNote.VATNO,'') AS VATNO,ISNULL(deliverynoteitem.VATPER,0) AS VATPER,ISNULL(VATAMT,0) AS VATAMT ,ISNULL(C.namear,'') as Arabicname,isnull(C.address1ar,'') as ArabicAddress , dbo.currency_conversion(DeliveryNote.NetAmount) as ARABICNETAMOUNT ,isnull(logoimage,'')as logoimage,isnull(signatureimage,'')as signatureimage,isnull(sealimage,'')as sealimage,isnull(footerimage,'')as footerimage,isnull(headderimage,'')as headderimage, j.Model,j.PlateNo,j.JobCardDate,i.CategoryName as Category from DeliveryNote JOIN Companydetails CD ON ISNULL(CD.BranchCode,@BranchCode)=@BranchCode inner join DeliveryNoteItem on DeliveryNote.DnNo=DeliveryNoteItem.DnNo LEFT JOIN CUSTOMER C ON C.CODE=DeliveryNote.CUSTOMERCODE left join JobCard j on j.JobCardNo=DeliveryNote.JobCardNo left join item i on i.itemcode=DeliveryNoteItem.ItemCode where DeliveryNote.DnNo=@DnNo ORDER BY DeliveryNoteItem.SlNo end go ALTER PROCEDURE [dbo].[sp_SaveQuotation] ( @QuotationNO nvarchar(50), @BranchCode varchar(10) ) AS begin SELECT RFQDate,Quotation.Del1,Quotation.Del2,Quotation.Del3,Quotation.Del4,Freight,Trans,Quotation.SalesMan,Quotation.AttenMob,Quotation.AttenEmail,Quotation.CustEmail,Quotation.QuotationNo, Quotation.EntryDate,Quotation.RefNo,Quotation.Attended,Quotation.custRefNo,Quotation.CustomerName,Quotation.CustomerCode,Quotation.Address,Quotation.Attention, Quotation.Telephone,Quotation.Fax,Quotation.GrossAmount,Quotation.NETDISC as LESS,Quotation.NetAmount,Quotation.Remarks,Quotation.PaymentTerms,Quotation.Validity, Quotation.PlaceOfDelivery,Quotation.DeliveryTime,QuotationItem.SlNo,QuotationItem.ItemName,QuotationItem.ItemCode,QuotationItem.Unit,QuotationItem.Qty, QuotationItem.Rate,QuotationItem.Amount,SalesMan.Mobile,SalesMan.email,ISNULL(QuotationItem.partno,'') AS partno,ISNULL(Quotation.Vatno,'') AS VATNO,ISNULL(Quotation.Vattotal,0) AS VATTOTAL, ISNULL(QuotationItem.Vatper,0) AS VATPER,ISNULL(QuotationItem.VatAmt,0) AS VATAMT ,ISNULL(C.NameAR,'') as Arabicname,isnull(C.Address1AR,'') as ArabicAddress , dbo.currency_conversion(QUOTATION.NetAmount) as ARABICNETAMOUNT ,isnull(logoimage,'')as logoimage,isnull(signatureimage,'')as signatureimage,isnull(sealimage,'')as sealimage,isnull(footerimage,'')as footerimage,isnull(headderimage,'')as headderimage, j.Model,j.JobCardDate,j.PlateNo,i.CategoryName as Category FROM Quotation INNER JOIN QuotationItem ON Quotation.QuotationNo = QuotationItem.QuotationNo left join SalesMan on Quotation.Attended=SalesMan.Code LEFT JOIN CUSTOMER C ON C.CODE=Quotation.CUSTOMERCODE JOIN Companydetails CD ON ISNULL(CD.BranchCode,@BranchCode)=@BranchCode LEFT JOIN JOBCARD J ON J.jobcardno=QUotation.JobcardNo Left join item i on i.itemcode=QuotationItem.ItemCode where Quotation.QuotationNo=@QuotationNO ORDER BY QuotationItem.SlNo end go ALTER PROCEDURE [dbo].[sp_SaveProformaInvoice] @InvNo varchar(50) AS begin SELECT ProformaInvoice.DELDate,ProformaInvoice.Branch,ProformaInvoice.CreditPeriod,ProformaInvoice.Bank1,ProformaInvoice.Bank2,ProformaInvoice.Bank3,ProformaInvoice.Bank4, ProformaInvoice.Del1,ProformaInvoice.Del2,ProformaInvoice.Del3,ProformaInvoice.Del4,ProformaInvoice.PODate,ProformaInvoice.Freight,ProformaInvoice.Retention,ProformaInvoice.BillType, ProformaInvoice.InvNo,ProformaInvoice.EntryDate,ProformaInvoice.PONo,ProformaInvoice.DnNo,ProformaInvoice.RefNo,ProformaInvoice.CustomerCode,ProformaInvoice.CustomerName, ProformaInvoice.Address,ProformaInvoice.Phone,ProformaInvoice.Fax,ProformaInvoice.Attended,ProformaInvoice.Narration,ProformaInvoice.GrossAmount,ProformaInvoice.NetAmount, ProformaInvoice.LessAmount AS less,ProformaInvoiceItem.SlNo,ProformaInvoiceItem.ItemCode,ProformaInvoiceItem.ItemName, ProformaInvoiceItem.PartNo,ProformaInvoiceItem.Rate,ProformaInvoiceItem.Unit,ProformaInvoiceItem.Qty,ProformaInvoiceItem.Amount, CONVERT(nchar, isnull(HijriDate,'01/01/1900'), 131) as HijriDate,isnull(ProformaInvoice.QuotNo,'') as QuotNo ,ISNULL(ProformaInvoiceITEM.VATPER,0) AS VATPER,ISNULL(ProformaInvoiceITEM.VATAMT,0)AS VATAMT,ISNULL(ProformaInvoice.VATTOTAL,0)AS VATTOTAL ,ISNULL(ProformaInvoice.Vatno,'')AS Vatno,isnull(ProformaInvoiceitem.rateafterdisc,0) as Rateafterdisc,ISNULL(ProformaInvoice.REMARKS1,'') AS REMARKSS,ProformaInvoice.MOBILE ,ISNULL(CONVERT(VARCHAR(25),D.ENTRYDATE,103),CONVERT(VARCHAR(25),ProformaInvoice.ENTRYDATE,103)) AS DNDATE,ISNULL(C.namear,'') as Arabicname,isnull(C.address1ar,'') as ArabicAddress ,CONVERT(VARCHAR(25),ProformaInvoice.EntryDate,103) 'DATE' , dbo.currency_conversion(ProformaInvoice.NetAmount) as ARABICNETAMOUNT,j.Model,j.PlateNo,j.JobCardDate,I.CategoryName as category FROM ProformaInvoice INNER JOIN ProformaInvoiceItem ON ProformaInvoice.InvNo = ProformaInvoiceItem.InvNo AND ProformaInvoice.SR = 'Sales'and ProformaInvoiceItem.SR = 'Sales' LEFT JOIN DELIVERYNOTE D ON D.DNNO=ProformaInvoiceITEM.DNNO LEFT JOIN CUSTOMER C ON C.CODE=ProformaInvoice.CUSTOMERCODE LEFT JOIN JOBCARD J ON J.jobcardno=proformainvoice.jobcardno LEFT JOIN ITEM I ON I.itemcode=ProformaInvoiceItem.ItemCode where ProformaInvoice.InvNo=@InvNo end