Example #1
0
 private void PrintGstReport(DateTime dateFrom, DateTime dateTo, List <GstInput> gstInputs)
 {
     using (var rptForm = new ReportForm(SelectedCompany, dateFrom, dateTo, gstInputs))
     {
         rptForm.ShowDialog(this);
     }
 }
Example #2
0
        private void PrintInvoice(PrintHeader printHeader, string fileExt, bool isDuplicate = false)
        {
            string partyDbf   = $"ACCTMAST.{fileExt}";
            string invoiceDbf = $"INV_HDR.{fileExt}";
            string salesDbf   = $"SALES.{fileExt}";
            string stockDbf   = $"SARSTOCK.{fileExt}";

            Party                party;
            SalesHeader          salesHeader;
            List <SalesLineItem> lineItems;
            string               tranName = string.Empty;

            using (var con = new OleDbConnection(YearConnectionString))
            {
                con.Open();
                string query = "SELECT CODE, NAME, ADDRESS, AREA, CITY, PIN AS PinCode, " +
                               "PHONE, SAL_TAX_NO AS GSTIN " +
                               $"FROM {partyDbf} WHERE CODE='{printHeader.PartyCode}'";
                party = con.QuerySingle <Party>(query);

                query = "SELECT BILL_NO AS Number, BILL_DT AS Date, REF_NO AS RefNumber, " +
                        "CODE AS PartyCode, TOT_QTY AS TotalQty, SUB_TOT AS Subtotal, " +
                        "PER_DISC1 AS Disc1Pct, DISCOUNT1 AS Disc1Amt, PER_DISC2 AS Disc2Pct, " +
                        "TOTALBTAX AS TotalBTax, " +
                        "PER_SGST AS SGSTPct, SGST AS SGSTAmt, PER_CGST CGSTPct, CGST AS CGSTAmt, " +
                        "PER_IGST AS IGSTPct, IGST AS IGSTAmt, PARCEL, NET_AMT AS NetAmount, PARTICULAR " +
                        $"FROM {invoiceDbf} WHERE BILL_NO='{printHeader.Number}'";
                salesHeader = con.QuerySingle <SalesHeader>(query);

                query = "SELECT s.BILL_NO AS InvoiceNumber, s.SL_NO AS SerialNumber, s.SAREE_NO AS SareeNumber, " +
                        "s.ITEM_NAME AS Description, s.ITEM_HSN AS HsnCode, s.PRICE AS Rate, p.NAME AS SupplierName " +
                        $"FROM {salesDbf} AS s " +
                        $"INNER JOIN ({stockDbf} AS t INNER JOIN {partyDbf} AS p ON t.CODE=p.CODE) ON s.SAREE_NO=t.SAREE_NO " +
                        $"WHERE s.BILL_NO='{printHeader.Number}' " +
                        $"ORDER BY s.BILL_NO, s.SL_NO";
                lineItems = con.Query <SalesLineItem>(query).ToList();

                query    = $"SELECT NAME FROM {partyDbf} WHERE CODE='{printHeader.TranCode}'";
                tranName = con.ExecuteScalar <string>(query);
            }
            salesHeader.GSTIN = SelectedCompany.GSTIN;

            if (ApplicationConfiguration.InvoiceForm == "CR")
            {
                using (var rptForm = new CrystalReportsForm(ApplicationConfiguration.InvoiceReport, salesHeader, party, lineItems, isDuplicate))   // SelectedCompany.Name
                {
                    rptForm.ShowDialog(this);
                }
            }
            else
            {
                using (var rptForm = new ReportForm(ApplicationConfiguration.InvoiceReport, SelectedCompany, party, salesHeader, lineItems))
                {
                    rptForm.ShowDialog(this);
                }
            }
        }
Example #3
0
        private void PrintInvoice(PrintHeader printHeader, string fileExt)
        {
            string partyDbf   = $"ACCTMAST.{fileExt}";
            string invoiceDbf = $"INV_HDR.{fileExt}";
            string salesDbf   = $"SALES.{fileExt}";

            Party                party;
            SalesHeader          salesHeader;
            List <SalesLineItem> lineItems;

            using (var con = new OleDbConnection(YearConnectionString))
            {
                con.Open();
                string query = "SELECT NAME, ADDRESS, AREA, CITY, PIN AS PinCode, " +
                               "PHONE, SAL_TAX_NO AS GSTIN " +
                               $"FROM {partyDbf} WHERE CODE='{printHeader.PartyCode}'";
                party = con.QuerySingle <Party>(query);

                query = "SELECT BILL_NO AS Number, BILL_DT AS Date, REF_NO AS RefNumber, " +
                        "TOT_QTY AS TotalQty, SUB_TOT AS Subtotal, " +
                        "PER_DISC1 AS Disc1Pct, DISCOUNT1 AS Disc1Amt, PER_DISC2 AS Disc2Pct, " +
                        "PER_SGST AS SGSTPct, SGST AS SGSTAmt, PER_CGST CGSTPct, CGST AS CGSTAmt, " +
                        "PER_IGST AS IGSTPct, IGST AS IGSTAmt, PARCEL, NET_AMT AS NetAmount, PARTICULAR " +
                        $"FROM {invoiceDbf} WHERE BILL_NO='{printHeader.Number}'";
                salesHeader = con.QuerySingle <SalesHeader>(query);

                query = "SELECT SL_NO AS SerialNumber, SAREE_NO AS SareeNumber, " +
                        "ITEM_NAME AS Description, ITEM_HSN AS HsnCode, PRICE AS Rate " +
                        $"FROM {salesDbf} WHERE BILL_NO='{printHeader.Number}'";
                lineItems = con.Query <SalesLineItem>(query).ToList();
            }

            using (var rptForm = new ReportForm(SelectedCompany, party, salesHeader, lineItems))
            {
                rptForm.ShowDialog(this);
            }
        }