public int AddUpdateInvoice(SalesInvoiceForm invoiceData)
        {
            ISalesInvoiceBL pqBL = new SalesInvoiceBL();
            int             i    = pqBL.AddUpdateInvoice(invoiceData);

            return(i);
        }
 private void CreateCreditNote(SalesInvoiceForm invoiceData)
 {
     try
     {
         using (SASEntitiesEDM entities = new SASEntitiesEDM())
         {
             CreditNote deb = entities.CreditNotes.Where(e => e.SI_Id == invoiceData.Invoice.ID).SingleOrDefault();
             if (Convert.ToDecimal(invoiceData.Invoice.TotalBeforeTax) < 0)
             {
                 if (deb != null)
                 {
                     deb.CN_Date = DateTime.Now.Date;
                     // deb.CN_No = "CN-" + (GetLastCreditNoteNo() + 1);
                     //deb.SI_Id = obj.ID;
                     deb.Cus_Id = invoiceData.Invoice.CustomerID;
                     // deb.Cus_DN_Amount = Convert.ToDecimal(invoiceData.Invoice.TotalBeforeTax);
                     deb.ModifiedDate = DateTime.Now;
                     entities.SaveChanges();
                 }
                 else
                 {
                     deb           = new CreditNote();
                     deb.CN_Date   = DateTime.Now.Date;
                     deb.CN_No     = "CN-" + (GetLastCreditNoteNo() + 1);
                     deb.SI_Id     = invoiceData.Invoice.ID;
                     deb.Cus_Id    = invoiceData.Invoice.CustomerID;
                     deb.CN_Status = Convert.ToByte(DN_Status.UnAdjusted);
                     deb.CN_Amount = Convert.ToDecimal(invoiceData.Invoice.TotalAfterTax);//change 3/13/2018
                     //deb.CN_Amount= Math.Abs(Convert.ToDecimal(invoiceData.Invoice.TotalAfterTax));
                     deb.CreatedDate = DateTime.Now;
                     entities.CreditNotes.Add(deb);
                     entities.SaveChanges();
                 }
             }
             else
             {
                 if (deb != null)
                 {
                     entities.CreditNotes.Remove(deb);
                     entities.SaveChanges();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public int UpdationInvoice(SalesInvoiceForm invoiceData)
        {
            ISalesInvoiceBL pqBL = new SalesInvoiceBL();

            return(pqBL.UpdationInvoice(invoiceData));
        }
示例#4
0
        /// <summary>
        /// This method is used to get Sales Invoice details
        /// </summary>
        /// <param name="pqId"></param>
        /// <returns></returns>
        public SalesInvoiceForm GetSalesInvoice(string pqno)
        {
            SalesInvoiceForm pqf = new SalesInvoiceForm();

            try
            {
                using (SDNSalesDBEntities entities = new SDNSalesDBEntities())
                {
                    var pq = (from pqs in entities.SalesInvoices
                              where pqs.SI_No == pqno && (pqs.IsDeleted == false || pqs.IsDeleted == null)
                              select new SalesInvoiceEntity
                    {
                        ID = pqs.ID,
                        CustomerID = pqs.Cus_Id,
                        InvoiceNo = pqs.SI_No,
                        InvoiceDate = pqs.SI_Date,
                        //    PaymentDueDate = pqs.SI_Pmt_Due_Date,
                        TermsAndConditions = pqs.SI_TandC,
                        TotalBeforeTax = pqs.SI_Tot_bef_Tax,
                        TotalTax = pqs.SI_GST_Amt,
                        TotalAfterTax = pqs.SI_Tot_aft_Tax,
                        ExcIncGST = pqs.Exc_Inc_GST,
                        OurSONo = pqs.Cus_PO_No,
                        CreditDays = pqs.SI_Credit_Days,
                        SalesmanID = pqs.Salesman,
                        SIStatus = pqs.SI_Status
                    }).SingleOrDefault();

                    if (pq != null)
                    {
                        pqf.Invoice = pq;
                    }


                    var pqd = (from pqds in entities.SalesInvoiceDetails
                               where pqds.SI_ID == pq.ID
                               select new SalesInvoiceDetailEntity
                    {
                        ID = pqds.ID,
                        SIID = pqds.SI_ID,
                        SINo = pqds.SI_No,
                        PandSCode = pqds.PandS_Code,
                        PandSName = pqds.PandS_Name,
                        SIQty = pqds.SI_Qty,
                        Price = pqds.SI_Price,
                        SIDiscount = pqds.SI_Discount,
                        SIAmount = pqds.SI_Amount,
                        GSTRate = pqds.GST_Rate
                    }).ToList <SalesInvoiceDetailEntity>();

                    if (pqd != null)
                    {
                        pqf.InvoiceDetails = pqd;
                    }

                    return(pqf);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#5
0
        /// <summary>
        /// This method is used to add or edit purchase invoice
        /// </summary>
        /// <param name="invoiceData"></param>
        /// <returns></returns>
        public int AddUpdateInvoice(SalesInvoiceForm invoiceData)
        {
            int autoId = 0;
            //Add purchase invoice
            SalesInvoice obj = new SalesInvoice();

            obj.ID     = invoiceData.Invoice.ID;
            obj.Cus_Id = invoiceData.Invoice.CustomerID;

            obj.SI_Date        = invoiceData.Invoice.InvoiceDate;
            obj.SI_GST_Amt     = Convert.ToDecimal(invoiceData.Invoice.TotalTax);
            obj.SI_No          = invoiceData.Invoice.InvoiceNo;
            obj.SI_TandC       = invoiceData.Invoice.TermsAndConditions;
            obj.SI_Tot_aft_Tax = Convert.ToDecimal(invoiceData.Invoice.TotalAfterTax);
            obj.SI_Tot_bef_Tax = Convert.ToDecimal(invoiceData.Invoice.TotalBeforeTax);
            obj.Cus_PO_No      = invoiceData.Invoice.OurSONo;
            obj.SI_Credit_Days = invoiceData.Invoice.CreditDays;
            obj.Salesman       = invoiceData.Invoice.SalesmanID;
            obj.Exc_Inc_GST    = invoiceData.Invoice.ExcIncGST;
            obj.SI_Status      = Convert.ToByte(SI_Status.UnPaid);
            obj.IsDeleted      = false;

            try
            {
                using (SDNSalesDBEntities entities = new SDNSalesDBEntities())
                {
                    if (entities.SalesInvoices.AsNoTracking().FirstOrDefault(x => x.ID == invoiceData.Invoice.ID) == null)
                    {
                        //obj.CreatedBy = invoiceData.SIModel.CreatedBy;
                        obj.CreatedDate = DateTime.Now;
                        entities.SalesInvoices.Add(obj);
                        entities.SaveChanges();
                        autoId = obj.ID;
                    }
                    else
                    {
                        // obj.ModifiedBy = invoiceData.SIModel.ModifiedBy;
                        obj.ModifiedDate          = DateTime.Now;
                        entities.Entry(obj).State = EntityState.Modified;
                        autoId = entities.SaveChanges();
                    }

                    invoiceData.Invoice.ID = autoId;
                    CreateCreditNote(invoiceData);

                    if (autoId > 0)
                    {
                        SalesInvoiceDetail SIDetails;
                        if (invoiceData.InvoiceDetails != null)
                        {
                            foreach (SalesInvoiceDetailEntity SIDetailEntity in invoiceData.InvoiceDetails)
                            {
                                SIDetails             = new SalesInvoiceDetail();
                                SIDetails.SI_ID       = autoId;
                                SIDetails.SI_No       = SIDetailEntity.SINo;
                                SIDetails.PandS_Code  = SIDetailEntity.PandSCode;
                                SIDetails.PandS_Name  = SIDetailEntity.PandSName;
                                SIDetails.SI_Amount   = SIDetailEntity.SIAmount;
                                SIDetails.SI_Discount = SIDetailEntity.SIDiscount;
                                SIDetails.SI_No       = SIDetailEntity.SINo;
                                SIDetails.SI_Price    = Convert.ToDecimal(SIDetailEntity.SIPrice);
                                SIDetails.SI_Qty      = SIDetailEntity.SIQty;
                                SIDetails.GST_Code    = SIDetailEntity.GSTCode;
                                SIDetails.GST_Rate    = SIDetailEntity.GSTRate;


                                if (entities.SalesInvoiceDetails.AsNoTracking().FirstOrDefault(x => x.ID == SIDetailEntity.ID) == null)
                                {
                                    entities.SalesInvoiceDetails.Add(SIDetails);
                                    entities.SaveChanges();
                                }
                                else
                                {
                                    entities.Entry(SIDetails).State = EntityState.Modified;
                                    entities.SaveChanges();
                                }

                                int SIId = Convert.ToInt32(SIDetailEntity.SINo);
                                ProductsAndService ps = entities.ProductsAndServices.SingleOrDefault(e => e.ID == SIId);
                                if (ps != null)
                                {
                                    if (ps.PandS_Qty_in_stock != null || ps.PandS_Qty_in_stock >= 0)
                                    {
                                        ps.PandS_Qty_in_stock = ps.PandS_Qty_in_stock - SIDetailEntity.SIQty;
                                        entities.SaveChanges();
                                    }
                                }
                            }
                        }
                    }
                }
                return(autoId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#6
0
        public int UpdationInvoice(SalesInvoiceForm invoiceData)
        {
            try
            {
                using (SDNSalesDBEntities entities = new SDNSalesDBEntities())
                {
                    SalesInvoice obj = entities.SalesInvoices.Where(e => e.SI_No == invoiceData.Invoice.InvoiceNo
                                                                    ).SingleOrDefault();
                    if (obj != null)
                    {
                        //obj.ID = invoiceData.Invoice.ID;
                        obj.Cus_Id = invoiceData.Invoice.CustomerID;

                        obj.SI_Date        = invoiceData.Invoice.InvoiceDate;
                        obj.SI_GST_Amt     = Convert.ToDecimal(invoiceData.Invoice.TotalTax);
                        obj.SI_No          = invoiceData.Invoice.InvoiceNo;
                        obj.SI_TandC       = invoiceData.Invoice.TermsAndConditions;
                        obj.SI_Tot_aft_Tax = Convert.ToDecimal(invoiceData.Invoice.TotalAfterTax);
                        obj.SI_Tot_bef_Tax = Convert.ToDecimal(invoiceData.Invoice.TotalBeforeTax);
                        //obj.SI_Pmt_Due_Date = invoiceData.Invoice.PaymentDueDate;
                        obj.Cus_PO_No      = invoiceData.Invoice.OurSONo;
                        obj.SI_Credit_Days = invoiceData.Invoice.CreditDays;
                        obj.Salesman       = invoiceData.Invoice.SalesmanID;
                        obj.Exc_Inc_GST    = invoiceData.Invoice.ExcIncGST;
                        obj.ModifiedDate   = DateTime.Now;
                        entities.SaveChanges();
                    }

                    invoiceData.Invoice.ID = obj.ID;
                    CreateCreditNote(invoiceData);

                    var objSales = entities.SalesInvoiceDetails.Where
                                       (e => e.SI_ID == obj.ID).ToList();
                    if (objSales != null)
                    {
                        foreach (var item in objSales)
                        {
                            int PSId = Convert.ToInt32(item.SI_No);
                            if (PSId != 0)
                            {
                                ProductsAndService ps = entities.ProductsAndServices.SingleOrDefault(e => e.ID == PSId);
                                if (ps != null)
                                {
                                    ps.PandS_Qty_in_stock = ps.PandS_Qty_in_stock + item.SI_Qty;
                                    entities.SaveChanges();
                                }
                            }

                            entities.SalesInvoiceDetails.Remove(item);
                            entities.SaveChanges();
                        }
                    }
                    SalesInvoiceDetail SIDetails;

                    if (invoiceData.InvoiceDetails != null)
                    {
                        foreach (SalesInvoiceDetailEntity SIDetailEntity in invoiceData.InvoiceDetails)
                        {
                            SIDetails             = new SalesInvoiceDetail();
                            SIDetails.SI_ID       = obj.ID;
                            SIDetails.SI_No       = SIDetailEntity.SINo;
                            SIDetails.PandS_Code  = SIDetailEntity.PandSCode;
                            SIDetails.PandS_Name  = SIDetailEntity.PandSName;
                            SIDetails.SI_Amount   = SIDetailEntity.SIAmount;
                            SIDetails.SI_Discount = SIDetailEntity.SIDiscount;
                            SIDetails.SI_No       = SIDetailEntity.SINo;
                            SIDetails.SI_Price    = Convert.ToDecimal(SIDetailEntity.SIPrice);
                            SIDetails.SI_Qty      = SIDetailEntity.SIQty;
                            SIDetails.GST_Code    = SIDetailEntity.GSTCode;
                            SIDetails.GST_Rate    = SIDetailEntity.GSTRate;

                            entities.SalesInvoiceDetails.Add(SIDetails);
                            entities.SaveChanges();

                            int PSId = Convert.ToInt32(SIDetailEntity.SINo);
                            if (PSId != 0)
                            {
                                ProductsAndService ps = entities.ProductsAndServices.SingleOrDefault(e => e.ID == PSId);
                                if (ps != null)
                                {
                                    ps.PandS_Qty_in_stock = ps.PandS_Qty_in_stock - SIDetailEntity.SIQty;
                                    entities.SaveChanges();
                                }
                            }
                        }
                    }
                    return(obj.ID);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public SalesInvoiceForm GetPrintSalesInvoice(string pino)
        {
            SalesInvoiceForm pif = new SalesInvoiceForm();

            try
            {
                using (SASEntitiesEDM entities = new SASEntitiesEDM())
                {
                    var pi = (from pis in entities.SalesInvoices
                              join Cus in entities.Customers on pis.Cus_Id equals Cus.ID
                              where pis.SI_No == pino && (pis.IsDeleted == false || pis.IsDeleted == null)
                              select new SalesInvoiceEntity
                    {
                        ID = pis.ID,
                        CustomerID = pis.Cus_Id,
                        CustomerName = Cus.Cus_Name,
                        CustomerBillAddress1 = Cus.Cus_Bill_to_line1,
                        CustomerBillAddress2 = Cus.Cus_Bill_to_line2,
                        CustomerBillAddressCity = Cus.Cus_Bill_to_city,
                        CustomerBillAddressState = Cus.Cus_Bill_to_state,
                        CustomerBillAddressCountary = Cus.Cus_Bill_to_country,
                        CustomerBillPostCode = Cus.Cus_Bill_to_post_code,
                        CustomerShipAddress1 = Cus.Cus_Ship_to_line1,
                        CustomerShipAddress2 = Cus.Cus_Ship_to_line2,
                        CustomerShipAddressCity = Cus.Cus_Ship_to_city,
                        CustomerShipAddressState = Cus.Cus_Ship_to_state,
                        CustomerShipAddressCountary = Cus.Cus_Ship_to_country,
                        CustomerShipPostCode = Cus.Cus_Ship_to_post_code,
                        CustomerTelephone = Cus.Cus_Telephone,
                        InvoiceNo = pis.SI_No,
                        InvoiceDate = pis.SI_Date,
                        CusPoNo = pis.Cus_PO_No,
                        CreditDays = pis.SI_Credit_Days,
                        PaymentDueDate = DbFunctions.AddDays(pis.SI_Date, pis.SI_Credit_Days),
                        TermsAndConditions = pis.SI_TandC,
                        TotalBeforeTax = pis.SI_Tot_bef_Tax,
                        TotalTax = pis.SI_GST_Amt,
                        TotalAfterTax = pis.SI_Tot_aft_Tax,
                        ExcIncGST = pis.Exc_Inc_GST,
                        SalesmanID = pis.Salesman
                    }).SingleOrDefault();
                    //var PaymentDueDate1 =pi.InvoiceDate.AddDays(Convert.ToInt32(pi.CreditDays));

                    if (pi != null)
                    {
                        pif.Invoice = pi;
                    }

                    //for comapany details

                    var company = (from com in entities.CompanyDetails
                                   where (com.IsDeleted == false || com.IsDeleted == null)
                                   select new SalesInvoiceEntity
                    {
                        CompanyName = com.Comp_Name,
                        CompanyRegNumber = com.Comp_Reg_No,
                        CompanyLogo = com.Comp_Logo,
                        CompanyGstNumber = com.Comp_GST_Reg_No,
                        CompanyBillToAddressLine1 = com.Comp_Bill_to_line1,
                        CompanyBillToAddressLine2 = com.Comp_Bill_to_line2,
                        CompanyBillToCity = com.Comp_Bill_to_city,
                        CompanyBillToState = com.Comp_Bill_to_state,
                        CompanyBillToCountary = com.Comp_Bill_to_country,
                        CompanyBillToPostCode = com.Comp_Bill_to_post_code,
                        CompanyEmail = com.Comp_Email,
                        CompanyFax = com.Comp_Fax
                    }).SingleOrDefault();

                    pif.Invoice.CompanyName               = company.CompanyName;
                    pif.Invoice.CompanyLogo               = company.CompanyLogo;
                    pif.Invoice.CompanyRegNumber          = company.CompanyRegNumber;
                    pif.Invoice.CompanyGstNumber          = company.CompanyGstNumber;
                    pif.Invoice.CompanyBillToAddressLine1 = company.CompanyBillToAddressLine1;
                    pif.Invoice.CompanyBillToAddressLine2 = company.CompanyBillToAddressLine2;
                    pif.Invoice.CompanyBillToCity         = company.CompanyBillToCity;
                    pif.Invoice.CompanyBillToState        = company.CompanyBillToState;
                    pif.Invoice.CompanyBillToCountary     = company.CompanyBillToCountary;
                    pif.Invoice.CompanyBillToPostCode     = company.CompanyBillToPostCode;
                    pif.Invoice.CompanyEmail              = company.CompanyEmail;
                    pif.Invoice.CompanyFax = company.CompanyFax;
                    //end for comapany details

                    //option details
                    var optiondata = (from option in entities.Options
                                      select new SalesInvoiceEntity
                    {
                        CurrencyCode = option.Currency_Code,
                        NameToPrintSalesInvoice = option.Name_to_Print_Sales_Invoice
                    }).SingleOrDefault();
                    pif.Invoice.CurrencyCode            = optiondata.CurrencyCode;
                    pif.Invoice.NameToPrintSalesInvoice = optiondata.NameToPrintSalesInvoice;
                    //end options details

                    var pid = (from pids in entities.SalesInvoiceDetails
                               where pids.SI_ID == pi.ID
                               select new SalesInvoiceDetailEntity
                    {
                        ID = pids.ID,
                        SIID = pids.SI_ID,
                        SINo = pids.SI_No,
                        PandSCode = pids.PandS_Code,
                        PandSName = pids.PandS_Name,
                        SIQty = pids.SI_Qty,
                        Price = pids.SI_Price,
                        SIDiscount = pids.SI_Discount,
                        SIAmount = pids.SI_Amount,
                        GSTRate = pids.GST_Rate
                    }).ToList <SalesInvoiceDetailEntity>();

                    if (pid != null)
                    {
                        pif.InvoiceDetails = pid;
                    }

                    return(pif);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#8
0
        //public System.Drawing.Image byteArrayToImage(byte[] bytesArr)
        //{
        //    using (var ms = new MemoryStream(bytesArr))
        //    {
        //        return System.Drawing.Image.FromStream(ms);
        //    }
        //}

        private void UserControl_LoadedSalesInvoices(object sender, RoutedEventArgs e)
        {
            //var a = _viewModel.PrintSalesQuotation();
            SalesInvoiceForm sqf = _viewModelSales.PrintSalesInvoice();

            // System.Drawing.Image newImage = byteArrayToImage(sqf.Quotation.CompanyLogo);
            // System.Drawing.Image x = (Bitmap)((new ImageConverter()).ConvertFrom(sqf.Quotation.CompanyLogo));


            //this is for table grid

            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("PandSCode", typeof(string)));
            dt.Columns.Add(new DataColumn("PandSName", typeof(string)));
            dt.Columns.Add(new DataColumn("Qty", typeof(string)));
            dt.Columns.Add(new DataColumn("Price", typeof(string)));
            dt.Columns.Add(new DataColumn("Discount", typeof(string)));
            dt.Columns.Add(new DataColumn("Amount", typeof(string)));
            dt.Columns.Add(new DataColumn("Rate", typeof(string)));

            //ReportingDataset ds = new ReportingDataset();


            foreach (var item in sqf.InvoiceDetails)
            {
                DataRow dr = dt.NewRow();
                dr["PandSCode"] = item.PandSCode;
                dr["PandSName"] = item.PandSName;
                dr["Qty"]       = item.SIQty;
                dr["Price"]     = item.Price.ToString();
                dr["Discount"]  = item.SIDiscount;
                dr["Amount"]    = item.SIAmount.ToString();
                dr["Rate"]      = item.GSTRate.ToString();
                dt.Rows.Add(dr);
            }



            ReportDataSource reportDataSource = new ReportDataSource();

            reportDataSource.Name  = "SalesInvoicesDataSet"; // Name of the DataSet we set in .rdlc
            reportDataSource.Value = dt;
            // end of product grid code
            DataTable dt4 = new DataTable();

            //for other than table
            dt4.Columns.Add(new DataColumn("TAndCondition", typeof(string)));
            dt4.Columns.Add(new DataColumn("TotalBeforeTaxStr", typeof(string)));
            dt4.Columns.Add(new DataColumn("TotalTax", typeof(string)));
            dt4.Columns.Add(new DataColumn("TotalAfterTaxStr", typeof(string)));
            dt4.Columns.Add(new DataColumn("SINo", typeof(string)));
            dt4.Columns.Add(new DataColumn("SIDate", typeof(string)));
            dt4.Columns.Add(new DataColumn("PaymentDueDate", typeof(string)));
            dt4.Columns.Add(new DataColumn("CustomerPONo", typeof(string)));

            DataRow dr4 = dt4.NewRow();

            dr4["TAndCondition"]     = sqf.Invoice.TermsAndConditions;
            dr4["TotalBeforeTaxStr"] = sqf.Invoice.TotalAfterTax;
            dr4["TotalTax"]          = sqf.Invoice.TotalTax.ToString();
            dr4["TotalAfterTaxStr"]  = sqf.Invoice.TotalAfterTax.ToString();
            dr4["SINo"]           = sqf.Invoice.InvoiceNo;
            dr4["SIDate"]         = sqf.Invoice.InvoiceDate.Date.ToString("dd/M/yyyy");
            dr4["PaymentDueDate"] = sqf.Invoice.PaymentDueDate;
            dr4["CustomerPONo"]   = sqf.Invoice.CusPoNo;
            dt4.Rows.Add(dr4);

            ReportDataSource reportDataSource4 = new ReportDataSource();

            reportDataSource4.Name  = "SalesInvoicesUniqueRecordDataSet"; // Name of the DataSet we set in .rdlc
            reportDataSource4.Value = dt4;
            // company details
            /*****Define column*****/
            DataTable dt1 = new DataTable();

            dt1.Columns.Add(new DataColumn("CompanyName", typeof(string)));
            dt1.Columns.Add(new DataColumn("CompanyLogo", typeof(byte[])));
            dt1.Columns.Add(new DataColumn("CompanyRegNumber", typeof(string)));
            dt1.Columns.Add(new DataColumn("CompanyGstNumber", typeof(string)));
            dt1.Columns.Add(new DataColumn("Telephone", typeof(string)));
            dt1.Columns.Add(new DataColumn("CompanyFax", typeof(string)));
            dt1.Columns.Add(new DataColumn("CompanyEmail", typeof(string)));
            dt1.Columns.Add(new DataColumn("CompanyBillToAddressLine1", typeof(string)));
            dt1.Columns.Add(new DataColumn("CompanyBillToAddressLine2", typeof(string)));
            dt1.Columns.Add(new DataColumn("CompanyBillToCity", typeof(string)));
            dt1.Columns.Add(new DataColumn("CompanyBillToState", typeof(string)));
            dt1.Columns.Add(new DataColumn("CompanyBillToCountary", typeof(string)));
            dt1.Columns.Add(new DataColumn("CompanyBillToPostCode", typeof(string)));
            /*****End  column*****/
            /*****data part*******/

            DataRow dr1 = dt1.NewRow();

            dr1["CompanyName"]               = sqf.Invoice.CompanyName;
            dr1["CompanyLogo"]               = sqf.Invoice.CompanyLogo;
            dr1["CompanyRegNumber"]          = sqf.Invoice.CompanyRegNumber;
            dr1["CompanyGstNumber"]          = sqf.Invoice.CompanyGstNumber;
            dr1["Telephone"]                 = sqf.Invoice.Telephone;
            dr1["CompanyFax"]                = sqf.Invoice.CompanyFax;
            dr1["CompanyEmail"]              = sqf.Invoice.CompanyEmail;
            dr1["CompanyBillToAddressLine1"] = sqf.Invoice.CompanyBillToAddressLine1;
            dr1["CompanyBillToAddressLine2"] = sqf.Invoice.CompanyBillToAddressLine2;
            dr1["CompanyBillToCity"]         = sqf.Invoice.CompanyBillToCity;
            dr1["CompanyBillToState"]        = sqf.Invoice.CompanyBillToState;
            dr1["CompanyBillToCountary"]     = sqf.Invoice.CompanyBillToCountary;
            dr1["CompanyBillToPostCode"]     = sqf.Invoice.CompanyBillToPostCode;

            dt1.Rows.Add(dr1);
            /*****data part*******/
            ReportDataSource reportDataSource1 = new ReportDataSource();

            reportDataSource1.Name  = "CompanyDetailsDataSet"; // Name of the DataSet we set in .rdlc
            reportDataSource1.Value = dt1;
            // end of company details

            //Customer Details
            /****column defn**/
            DataTable dt2 = new DataTable();

            dt2.Columns.Add(new DataColumn("CustomerName", typeof(string)));
            dt2.Columns.Add(new DataColumn("CustomerBillAddress1", typeof(string)));
            dt2.Columns.Add(new DataColumn("CustomerBillAddress2", typeof(string)));
            dt2.Columns.Add(new DataColumn("CustomerBillAddressCity", typeof(string)));
            dt2.Columns.Add(new DataColumn("CustomerBillAddressState", typeof(string)));
            dt2.Columns.Add(new DataColumn("CustomerBillAddressCountary", typeof(string)));
            dt2.Columns.Add(new DataColumn("CustomerBillPostCode", typeof(string)));
            dt2.Columns.Add(new DataColumn("CustomerShipAddress1", typeof(string)));
            dt2.Columns.Add(new DataColumn("CustomerShipAddress2", typeof(string)));
            dt2.Columns.Add(new DataColumn("CustomerShipAddressCity", typeof(string)));
            dt2.Columns.Add(new DataColumn("CustomerShipAddressState", typeof(string)));
            dt2.Columns.Add(new DataColumn("CustomerShipAddressCountary", typeof(string)));
            dt2.Columns.Add(new DataColumn("CustomerShipPostCode", typeof(string)));
            dt2.Columns.Add(new DataColumn("CustomerTelephone", typeof(string)));
            /****end column defn**/
            /**data****/
            DataRow dr2 = dt2.NewRow();

            dr2["CustomerName"]                = sqf.Invoice.CustomerName;
            dr2["CustomerBillAddress1"]        = sqf.Invoice.CustomerBillAddress1;
            dr2["CustomerBillAddress2"]        = sqf.Invoice.CustomerBillAddress2;
            dr2["CustomerBillAddressCity"]     = sqf.Invoice.CustomerBillAddressCity;
            dr2["CustomerBillAddressState"]    = sqf.Invoice.CustomerBillAddressState;
            dr2["CustomerBillAddressCountary"] = sqf.Invoice.CustomerBillAddressCountary;
            dr2["CustomerBillPostCode"]        = sqf.Invoice.CustomerBillPostCode;
            dr2["CustomerShipAddress1"]        = sqf.Invoice.CustomerShipAddress1;
            dr2["CustomerShipAddress2"]        = sqf.Invoice.CustomerShipAddress2;
            dr2["CustomerShipAddressCity"]     = sqf.Invoice.CustomerShipAddressCity;
            dr2["CustomerShipAddressState"]    = sqf.Invoice.CustomerShipAddressState;
            dr2["CustomerShipAddressCountary"] = sqf.Invoice.CustomerShipAddressCountary;
            dr2["CustomerShipPostCode"]        = sqf.Invoice.CustomerShipPostCode;
            dr2["CustomerTelephone"]           = sqf.Invoice.CustomerTelephone;

            /**end data****/
            dt2.Rows.Add(dr2);
            ReportDataSource reportDataSource2 = new ReportDataSource();

            reportDataSource2.Name  = "CustomerDetailsDataSet"; // Name of the DataSet we set in .rdlc
            reportDataSource2.Value = dt2;
            //End Customer Details

            //option
            DataTable dt3 = new DataTable();

            dt3.Columns.Add(new DataColumn("CurrencyCode", typeof(string)));
            dt3.Columns.Add(new DataColumn("NameToPrintSalesInvoice", typeof(string)));

            DataRow dr3 = dt3.NewRow();

            dr3["CurrencyCode"]            = sqf.Invoice.CurrencyCode;
            dr3["NameToPrintSalesInvoice"] = sqf.Invoice.NameToPrintSalesInvoice;
            dt3.Rows.Add(dr3);

            ReportDataSource reportDataSource3 = new ReportDataSource();

            reportDataSource3.Name  = "OptionsDataSet"; // Name of the DataSet we set in .rdlc
            reportDataSource3.Value = dt3;
            //end options
            string exefolder  = System.Windows.Forms.Application.StartupPath;
            string reportPath = System.IO.Path.Combine(exefolder, @"SalesInvoices.rdlc");

            reportViewer3.LocalReport.ReportPath = reportPath;
            //D:\DayUser\src\SAS - NEW\Client\SASClient\Reports\ReportsRdlc
            reportViewer3.LocalReport.DataSources.Clear();
            reportViewer3.LocalReport.DataSources.Add(reportDataSource);
            reportViewer3.LocalReport.DataSources.Add(reportDataSource1);
            reportViewer3.LocalReport.DataSources.Add(reportDataSource2);
            reportViewer3.LocalReport.DataSources.Add(reportDataSource3);
            reportViewer3.LocalReport.DataSources.Add(reportDataSource4);
            reportViewer3.RefreshReport();

            // this.reportViewer1.Width = 75;
        }
        public int UpdationInvoice(SalesInvoiceForm quotationData)
        {
            ISalesInvoiceDAL PQDAL = new SalesInvoiceDAL();

            return(PQDAL.UpdationInvoice(quotationData));
        }