Exemple #1
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);
                }
            }
        }
Exemple #2
0
        private void PrintTag(PrintHeader printTag, string fileExt)
        {
            //string partyDbf = $"ACCTMAST.{fileExt}";
            //string invoiceDbf = $"INV_HDR.{fileExt}";
            string purchaseDbf = $"PURCHASE.{fileExt}";

            //Party party;
            //SalesHeader salesHeader;
            List <ProductTag> productTags;

            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='{printTag.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='{printTag.Number}'";
                //salesHeader = con.QuerySingle<SalesHeader>(query);

                string query = "SELECT SAREE_NO AS TagNumber, GROUP_NAME AS GroupName, " +
                               "ITEM_NAME AS ItemName, COST AS CostPrice, SELL_PRICE AS SellingPrice " +
                               $"FROM {purchaseDbf} WHERE BILL_NO='{printTag.Number}'";
                productTags = con.Query <ProductTag>(query)
                              .ToList();
                foreach (var pt in productTags)
                {
                    pt.UpdatePriceCode(ApplicationConfiguration.PriceCodeConfig);
                }
            }

            //using (var rptForm = new ReportForm(SelectedCompany.Name, productTags))
            //{
            //    rptForm.ShowDialog(this);
            //}
            using (var rptForm = new CrystalReportsForm(ApplicationConfiguration.TagReport, productTags))   // SelectedCompany.Name
            {
                rptForm.ShowDialog(this);
            }
        }
Exemple #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);
            }
        }