示例#1
0
        private bool print_receipt()
        {
            try
            {
                List <DataTable> aDataTableList = new List <DataTable>();
                DataTable        aDataTable1    = new DataTable();
                aDataTable1.Columns.Add("[border=true1]" + ReceiptText.RctTxtToPayAmount);
                aDataTable1.Columns.Add(PaymentAmountTxtBox.Text);

                aDataTable1.Rows.Add();
                aDataTable1.Rows[0][0] = ReceiptText.RctTxtPayMethod;
                aDataTable1.Rows[0][1] = PaymentMethodCheckBox.Text;
                aDataTable1.Rows.Add();
                double OldCustomerAccountAmountParser = 0;
                if (double.TryParse(CustomerBalanceTxtBox.Text, out OldCustomerAccountAmountParser))
                {
                    aDataTable1.Rows[1][0] = ReceiptText.RctTxtOldBalance;
                    aDataTable1.Rows[1][1] = OldCustomerAccountAmountParser;
                    aDataTable1.Rows.Add();
                    aDataTable1.Rows[2][0] = ReceiptText.RctTxtNewBalance;
                    aDataTable1.Rows[2][1] = OldCustomerAccountAmountParser - double.Parse(PaymentAmountTxtBox.Text);
                }

                aDataTableList.Add(aDataTable1);
                List <string> aStringList = ReportsHelper.ImportReportHeader(0, 0);
                List <string> aFooterList = ReportsHelper.ImportReportHeader(1, 0);
                aStringList.Add(SharedVariables.Line_Solid_10px_Black);
                aStringList.Add(ReceiptName.RctNmsCustomerPay);
                aStringList.Add("<h2>" + ReceiptText.RctTxtDate + "/" + ReceiptText.RctTxtTime + " " + DateTime.Now.ToShortDateString() + "&nbsp;&nbsp;" + DateTime.Now.ToShortTimeString() + "</h2>");
                aStringList.Add("<h2> " + ReceiptText.RctTxtTeller + ":&nbsp;&nbsp;" + SharedFunctions.ReturnLoggedUserName() + "</h2>");
                aStringList.Add(ReceiptText.RctTxtCustomer + ":&nbsp;&nbsp;" + CustomerNameComboBox.Text);
                aStringList.Add(ReceiptText.RctTxtPaymentNum + ":&nbsp; " + PaymentNumberTxtBox.Text);
                aStringList.Add(SharedVariables.Line_Solid_10px_Black);
                // PrintingManager.Instance.PrintTables(aDataTableList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, true, true);
                PrintingManager.Instance.PrintTables(aDataTableList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, !PrintingThermalA4ChkBox.Checked, !PrintingThermalA4ChkBox.Checked, PrintingThermalA4ChkBox.Checked, ReportsHelper.TempOutputPath + ".pdf", false, "", false, PrintingThermalA4ChkBox.Checked);
                if (PrintingThermalA4ChkBox.Checked)
                {
                    Process.Start(ReportsHelper.TempPDFOutputPath);
                }
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(MsgTxt.UnexpectedError + "\n Exception: IN[AddCustomerPayment:Print Receipt [EXCEPTION IS]] \n" + ex.Message, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
示例#2
0
        private bool print_receipt()
        {
            try
            {
                List <DataTable> aDataTableList = new List <DataTable>();
                DataTable        aDataTable1    = new DataTable();
                aDataTable1.Columns.Add("[border=true1]<th width=45%>" + ReceiptText.RctTxtItemName);
                aDataTable1.Columns.Add(ReceiptText.RctTxtUnitPrice);
                aDataTable1.Columns.Add(ReceiptText.RctTxtQty);
                aDataTable1.Columns.Add(ReceiptText.RctTxtTotal);
                aDataTable1.Columns.Add(ReceiptText.RctTxtDiscount + " %");

                bool NoDiscount = true;
                foreach (DataGridViewRow aRow in TeldgView.Rows)
                {
                    aDataTable1.Rows.Add();
                    aDataTable1.Rows[aRow.Index][0] = aRow.Cells["Description"].Value.ToString();
                    aDataTable1.Rows[aRow.Index][1] = aRow.Cells["PricePerUnit"].Value.ToString();
                    aDataTable1.Rows[aRow.Index][2] = aRow.Cells["Qty"].Value.ToString();
                    aDataTable1.Rows[aRow.Index][3] = aRow.Cells["PriceTotal"].Value.ToString();

                    aDataTable1.Rows[aRow.Index][4] = aRow.Cells["DiscountPerc"].Value.ToString();
                    if (double.Parse(aRow.Cells["DiscountPerc"].Value.ToString()) > 0)
                    {
                        NoDiscount = false;
                    }
                }

                if (NoDiscount)
                {
                    aDataTable1.Columns.Remove(aDataTable1.Columns[4]);
                }
                int       RowCnt      = 0;
                DataTable aDataTable3 = new DataTable();
                aDataTable3.Columns.Add("[border=true1]<th>" + ReceiptText.RctTxtSubTotal);
                aDataTable3.Columns.Add(SubtotalTxtBox.Text + "JOD");
                RowCnt = 0;

                aDataTable3.Rows.Add();
                aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtTax;
                aDataTable3.Rows[RowCnt++][1] = TotalTaxTxtBox.Text + "<b> JOD";

                if (double.Parse(DiscountTxtBox.Text) != 0)
                {
                    aDataTable3.Rows.Add();
                    aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtVoucherDiscount;
                    aDataTable3.Rows[RowCnt++][1] = "@" + DiscountPercTxtBox.Text + "% =" + DiscountTxtBox.Text + "<b> JOD";
                }
                if (double.Parse(ItemsDiscountTxtBox.Text) != 0)
                {
                    aDataTable3.Rows.Add();
                    aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtItemsDiscount;
                    aDataTable3.Rows[RowCnt++][1] = ItemsDiscountTxtBox.Text + "<b> JOD";
                }
                if (double.Parse(TotalDiscountTxtBox.Text) != 0)
                {
                    aDataTable3.Rows.Add();
                    aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtTotalDiscount;
                    aDataTable3.Rows[RowCnt++][1] = TotalDiscountTxtBox.Text + "<b> JOD";
                }
                if (double.Parse(FeesTxtBox.Text) != 0)
                {
                    aDataTable3.Rows.Add();
                    aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtFees;
                    aDataTable3.Rows[RowCnt++][1] = FeesTxtBox.Text + "<b> JOD";
                }


                aDataTable3.Rows.Add();
                aDataTable3.Rows[RowCnt][0]   = "<td style=\"background-color:#000;color:#fff;border-right-color:#fff;\"><b><font size=4>" + ReceiptText.RctTxtToPayAmount + "</font>";
                aDataTable3.Rows[RowCnt++][1] = "<td style=\"background-color:#000;color:#fff;border-left-color:#fff\"><b><font size=5>" + TotalTxtBox.Text + " JOD </font>";

                aDataTable3.Rows.Add();
                aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtPayMethod;
                aDataTable3.Rows[RowCnt++][1] = PaymentMethodCheckBox.Text;
                if (PaymentMethodCheckBox.Text.ToUpper() == "CASH")
                {
                    if (CashMethodComboBox.Text == "Cash")
                    {
                        aDataTable3.Rows.Add();
                        aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtCashIn;
                        aDataTable3.Rows[RowCnt++][1] = CashInTxtBox.Text + "<b> " + " JOD";
                        double tempamt = 0;
                        if (double.TryParse(ExchangeTxtBox.Text, out tempamt))
                        {
                            if (tempamt != 0)
                            {
                                aDataTable3.Rows.Add();
                                aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtExchange;
                                aDataTable3.Rows[RowCnt++][1] = ExchangeTxtBox.Text + "<b> JOD";
                            }
                        }
                    }
                    else if (CashMethodComboBox.Text == "Invoice")
                    {
                        aDataTable3.Rows.Add();
                        aDataTable3.Rows[RowCnt][0] = ReceiptText.RctTxtPayable;
                        double VendorAccountAmountParserChk = 0;
                        if (double.TryParse(VendorAccountAmountTxtBox.Text, out VendorAccountAmountParserChk))
                        {
                            aDataTable3.Rows[RowCnt++][1] = ReceiptText.RctTxtOldBalance + " = " + VendorAccountAmountParserChk + "&nbsp;&nbsp;" + SharedVariables.Line_Solid_10px_Black +
                                                            ReceiptText.RctTxtNewBalance + " = " + Math.Round((VendorAccountAmountParserChk + double.Parse(TotalTxtBox.Text)), 3);
                        }
                    }
                }

                aDataTableList.Add(aDataTable1);
                // aDataTableList.Add(aDataTable2);
                aDataTableList.Add(aDataTable3);

                List <string> aStringList = ReportsHelper.ImportReportHeader(0, 0);
                List <string> aFooterList = ReportsHelper.ImportReportHeader(1, 0);

                aStringList.Add(SharedVariables.Line_Solid_10px_Black);
                aStringList.Add(ReceiptName.RctNmsPurchase);


                aStringList.Add("*** " + ReceiptText.RctTxtDuplicate + " ***");
                if (aPurchaseDataRow["IsRevised"].ToString() == "1")
                {
                    aStringList.Add("*** " + ReceiptText.RctTxtReversed + " ***");
                    aStringList.Add("<h2> " + ReceiptText.RctTxtReversedBy + ":&nbsp;&nbsp;" + RevisedBylbl.Text + "</h2>");
                    aStringList.Add("<h2> " + ReceiptText.RctTxtReversedOn + ":&nbsp;&nbsp;" + ReviseDatelbl.Text + "</h2>");
                }

                aStringList.Add("<h2>" + ReceiptText.RctTxtOrgDate + "/" + ReceiptText.RctTxtOrgTime + " " + DateLbl.Text + "&nbsp;&nbsp;" + TimeLbl.Text + "</h2>");
                aStringList.Add("<h2> " + ReceiptText.RctTxtOrgTeller + ":&nbsp;&nbsp;" + TellerLbl.Text + "</h2>");
                aStringList.Add("<h2>" + ReceiptText.RctTxtReprintedOn + " " + DateTime.Now.ToShortDateString() + "&nbsp;&nbsp;" + DateTime.Now.ToShortTimeString() + "</h2>");
                aStringList.Add("<h2> " + ReceiptText.RctTxtReprintedBy + ":&nbsp;&nbsp;" + SharedFunctions.ReturnLoggedUserName() + "</h2>");

                aStringList.Add("<h2> " + ReceiptText.RctTxtVendor + ":&nbsp;&nbsp;" + VendorsComboBox.Text + "</h2>");


                aStringList.Add(ReceiptText.RctTxtPurchaseNumber + ":&nbsp; " + PurchaseVoucherNumTxtBox.Text);
                aStringList.Add(SharedVariables.Line_Solid_10px_Black);

                PrintingManager.Instance.PrintTables(aDataTableList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, true, true);
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(MsgTxt.UnexpectedError + "\n Exception: IN[Edit PurchaseVoucher:Print Receipt [EXCEPTION IS]] \n" + ex.Message, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
示例#3
0
        private bool print_receipt()
        {
            try
            {
                List <DataTable> aDataTableList = new List <DataTable>();
                DataTable        aDataTable1    = new DataTable();
                aDataTable1.Columns.Add("[border=true1]<th width=45%>" + ReceiptText.RctTxtItemName);
                aDataTable1.Columns.Add(ReceiptText.RctTxtUnitCost);
                aDataTable1.Columns.Add(ReceiptText.RctTxtQty);
                aDataTable1.Columns.Add(ReceiptText.RctTxtTotal);

                foreach (DataGridViewRow aRow in TeldgView.Rows)
                {
                    aDataTable1.Rows.Add();
                    aDataTable1.Rows[aRow.Index][0] = aRow.Cells["Description"].Value.ToString();
                    aDataTable1.Rows[aRow.Index][1] = aRow.Cells["PricePerUnit"].Value.ToString();
                    aDataTable1.Rows[aRow.Index][2] = aRow.Cells["Qty"].Value.ToString();
                    aDataTable1.Rows[aRow.Index][3] = aRow.Cells["PriceTotal"].Value.ToString();
                }
                int       RowCnt      = 0;
                DataTable aDataTable3 = new DataTable();
                aDataTable3.Columns.Add("[border=true1]<th>" + ReceiptText.RctTxtTax);
                aDataTable3.Columns.Add(TaxTxtBox.Text + "JOD");
                RowCnt = 0;


                aDataTable3.Rows.Add();
                aDataTable3.Rows[RowCnt][0]   = "<td style=\"background-color:#000;color:#fff;border-right-color:#fff;\"><b><font size=4>" + ReceiptText.RctTxtTotal + "</font>";
                aDataTable3.Rows[RowCnt++][1] = "<td style=\"background-color:#000;color:#fff;border-left-color:#fff\"><b><font size=5>" + TotalTxtBox.Text + " JOD </font>";

                aDataTable3.Rows.Add();
                aDataTable3.Rows[RowCnt][0]   = ReceiptText.RctTxtDisposalReason;
                aDataTable3.Rows[RowCnt++][1] = DisposalReasonComboBox.Text;

                aDataTableList.Add(aDataTable1);
                // aDataTableList.Add(aDataTable2);
                aDataTableList.Add(aDataTable3);

                List <string> aStringList = ReportsHelper.ImportReportHeader(0, 0);
                List <string> aFooterList = ReportsHelper.ImportReportHeader(1, 0);

                aStringList.Add(SharedVariables.Line_Solid_10px_Black);
                aStringList.Add(ReceiptName.RctNmsDisposeitems);
                aStringList.Add("<h2>" + ReceiptText.RctTxtDate + "/" + ReceiptText.RctTxtTime + " " + DateTime.Now.ToShortDateString() + "&nbsp;&nbsp;" + DateTime.Now.ToShortTimeString() + "</h2>");
                aStringList.Add("<h2> " + ReceiptText.RctTxtTeller + ":&nbsp;&nbsp;" + SharedFunctions.ReturnLoggedUserName() + "</h2>");

                aStringList.Add(ReceiptText.RctTxtDisposeInvNumber + ":&nbsp; " + InvoiceNumTxtBox.Text);
                aStringList.Add(SharedVariables.Line_Solid_10px_Black);
                PrintingManager.Instance.PrintTables(aDataTableList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, !PrintingThermalA4ChkBox.Checked, !PrintingThermalA4ChkBox.Checked, PrintingThermalA4ChkBox.Checked, ReportsHelper.TempOutputPath + ".pdf", false, "", false, PrintingThermalA4ChkBox.Checked);
                if (PrintingThermalA4ChkBox.Checked)
                {
                    Process.Start(ReportsHelper.TempPDFOutputPath);
                }
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(MsgTxt.UnexpectedError + "\n Exception: IN[DisposeItems:Print Receipt [EXCEPTION IS]] \n" + ex.Message, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
示例#4
0
        private bool ExportToPDF(int GeneralNumber)
        {
            try
            {
                List<DataTable> aDataTableList = new List<DataTable>();
                DataTable aDataTable1 = new DataTable();
                aDataTable1.Columns.Add("[border=true1]" + "<th width=15%>" + ReportsText.BarcodeRepTxt);
                aDataTable1.Columns.Add("<th width=20%>" + ReportsText.DescriptionRepTxt);
                aDataTable1.Columns.Add("<th width=9%>" + ReportsText.AvgCostRepTxt);
                aDataTable1.Columns.Add("<th width=9%>" + ReportsText.AvaQtyRepTxt);
                aDataTable1.Columns.Add(ReportsText.PhysicalCountRepTxt);
                aDataTable1.Columns.Add(ReportsText.DifferencesRepTxt);
                aDataTable1.Columns.Add(ReportsText.DifferenceValueRepTxt);

                double TotalPositive = 0.00, TotalNegative = 0.00, ParsingTester = 0.00; ;
                foreach (DataRow aRow in aItemsTable.Rows)
                {
                    if (double.Parse(aRow["DifferencesColumn"].ToString()) == 0)
                    {
                        if (ACTIVE_MODE == AdjustItemsFrmModes.EDIT_MODE)
                        {
                            AdjustInventoryDetailedMgmt.DeleteDetailedEntries(GeneralNumber,int.Parse(aRow["ID"].ToString()));
                        }

                        continue;
                    }
                    DataRow aToAddRow = aDataTable1.Rows.Add();
                    if (ACTIVE_MODE==AdjustItemsFrmModes.ADDING_MODE)
                    {
                        aToAddRow[0] = aRow["Barcode"];
                        aToAddRow[1] = aRow["Description"];
                        aToAddRow[2] = Math.Round(double.Parse(aRow["AvgUnitCost"].ToString()), 3);
                        aToAddRow[3] = Math.Round(double.Parse(aRow["Qty"].ToString()), 3);
                        aToAddRow[4] = aRow["PhysicalCountColumn"];
                        aToAddRow[5] = aRow["DifferencesColumn"];
                        ParsingTester = double.Parse(aRow["DiffValueColumn"].ToString());
                        aToAddRow[6] = ParsingTester;  
                    }
                    else if (ACTIVE_MODE == AdjustItemsFrmModes.EDIT_MODE)
                    {
                        aToAddRow[0] = ReportsHelper.FindData(AllItemsTable, "ID", "Barcode", aRow["ItemID"].ToString());
                        aToAddRow[1] = ReportsHelper.FindData(AllItemsTable, "ID", "Description", aRow["ItemID"].ToString());
                        aToAddRow[2] = Math.Round(double.Parse(ReportsHelper.FindData(AllItemsTable, "ID", "AvgUnitCost", aRow["ItemID"].ToString())), 3);
                        aToAddRow[3] = Math.Round(double.Parse(ReportsHelper.FindData(AllItemsTable, "ID", "Qty", aRow["ItemID"].ToString())), 3);
                        aToAddRow[4] = aRow["PhysicalCountColumn"];
                        aToAddRow[5] = aRow["DifferencesColumn"];
                        ParsingTester = double.Parse(aRow["DiffValueColumn"].ToString());
                        aToAddRow[6] = ParsingTester; 
                    }
                    
                    if (ParsingTester > 0)
                    {
                        TotalPositive += ParsingTester;
                    }
                    else
                    {
                        TotalNegative += ParsingTester;
                    }
                }

                if (aDataTable1.Rows.Count == 0)
                {
                    DataTable aEmptyTable = new DataTable();
                    aEmptyTable.Columns.Add("INVENTORY STOCK AVAILABLE QTY MATCHES 100% THE PHYSICAL COUNT");
                    aDataTableList.Add(aEmptyTable);
                }
                else
                {

                    aDataTableList.Add(aDataTable1);
                    DataRow NetRow = aDataTable1.Rows.Add();
                    string EmptyNoborderRow = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + ReportsHelper.MANUAL_TD_END;
                    NetRow[0] = EmptyNoborderRow;
                    NetRow[1] = EmptyNoborderRow;
                    NetRow[2] = EmptyNoborderRow;
                    NetRow[3] = EmptyNoborderRow;
                    NetRow[4] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + ReportsText.TotalRepTxt + ReportsHelper.MANUAL_TD_END;
                    NetRow[5] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + ReportsText.PosAdjValueRepTxt + ReportsHelper.MANUAL_TD_END;
                    NetRow[6] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + TotalPositive + ReportsHelper.MANUAL_TD_END;
                    NetRow = aDataTable1.Rows.Add();
                    NetRow[0] = EmptyNoborderRow;
                    NetRow[1] = EmptyNoborderRow;
                    NetRow[2] = EmptyNoborderRow;
                    NetRow[3] = EmptyNoborderRow;
                    NetRow[4] = EmptyNoborderRow;
                    NetRow[5] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + ReportsText.NegAdjValueRepTxt + ReportsHelper.MANUAL_TD_END;
                    NetRow[6] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + TotalNegative + ReportsHelper.MANUAL_TD_END;
                    NetRow = aDataTable1.Rows.Add();
                    NetRow[0] = EmptyNoborderRow;
                    NetRow[1] = EmptyNoborderRow;
                    NetRow[2] = EmptyNoborderRow;
                    NetRow[3] = EmptyNoborderRow;
                    NetRow[4] = EmptyNoborderRow;
                    NetRow[5] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + "<b>" + ReportsText.NetValueRepTxt + "<b>" + ReportsHelper.MANUAL_TD_END;
                    NetRow[6] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.UNDERLINE + ReportsHelper.NOBORDER + ReportsHelper.MANUAL_TD_OPTION_END + (TotalNegative + TotalPositive) + ReportsHelper.MANUAL_TD_END;

                }
                List<string> aStringList = ReportsHelper.ImportReportHeader(0, 1);
                List<string> aFooterList = ReportsHelper.ImportReportHeader(1, 1);

                aStringList.Add(SharedVariables.Line_Solid_10px_Black);
              
                if (ACTIVE_MODE==AdjustItemsFrmModes.ADDING_MODE)
                {
                    aStringList.Add(ReportsNames.InventoryStockAdjustRepName);
                    aStringList.Add("<h2>" + ReportsText.PrintedOnrepTxt + " " + DateTime.Now.ToShortDateString() + "&nbsp;&nbsp;" + DateTime.Now.ToShortTimeString() + "</h2>");
                    aStringList.Add("<h2> " + ReportsText.PrintedByrepTxt + ":&nbsp;&nbsp;" + SharedFunctions.ReturnLoggedUserName() + "</h2>");
                }
                else
                {
                    aStringList.Add("Update "+ReportsNames.InventoryStockAdjustRepName );
                    aStringList.Add("<h2>" + ReceiptText.RctTxtOrgDate + " " +DateTime.Parse( aAdjustGeneralList.Rows[0]["Date"].ToString()).ToShortDateString() + "</h2>");
                    aStringList.Add("<h2> " + ReceiptText.RctTxtOrgTeller + ":&nbsp;&nbsp;" +aUserRow["UserName"].ToString() + "</h2>");

                    aStringList.Add("<h2>" + ReceiptText.RctTxtReprintedOn + " " + DateTime.Now.ToShortDateString() + "&nbsp;&nbsp;" + DateTime.Now.ToShortTimeString() + "</h2>");
                    aStringList.Add("<h2> " + ReceiptText.RctTxtReprintedBy + ":&nbsp;&nbsp;" + SharedFunctions.ReturnLoggedUserName() + "</h2>");
                }

                aStringList.Add(ReceiptText.RctTxtInvoiceNum + ":&nbsp; " + GeneralNumber);
                aStringList.Add(SharedVariables.Line_Solid_10px_Black);

                PrintingManager.Instance.PrintTables(aDataTableList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, false, false, !XlsChkBox.Checked, ReportsHelper.TempPDFOutputPath, XlsChkBox.Checked, ReportsHelper.TempOutputPathExcel, false, false);

                if (XlsChkBox.Checked)
                {
                    Process.Start(ReportsHelper.TempOutputPathExcel);
                }
                else
                {
                    Process.Start(ReportsHelper.TempPDFOutputPath);
                }
                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(MsgTxt.UnexpectedError + "\n Exception: IN[AdjustItemsFrm:ExportToPDF [EXCEPTION IS]] \n" + ex.Message, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

        }
示例#5
0
        //To Make Size Always Normal For Non-Grid Forms

        private bool print_receipt()
        {
            try
            {
                List <DataTable> aDataTableList = new List <DataTable>();
                DataTable        aDataTable1    = new DataTable();
                aDataTable1.Columns.Add("[border=true1]" + ReceiptText.RctTxtToPayAmount);
                aDataTable1.Columns.Add(PaymentAmountTxtBox.Text);

                aDataTable1.Rows.Add();
                aDataTable1.Rows[0][0] = ReceiptText.RctTxtPayMethod;
                aDataTable1.Rows[0][1] = PaymentMethodCheckBox.Text;
                aDataTable1.Rows.Add();
                double OldCustomerAccountAmountParser = 0;
                if (double.TryParse(CustomerBalanceTxtBox.Text, out OldCustomerAccountAmountParser))
                {
                    aDataTable1.Rows[1][0] = ReceiptText.RctTxtOldBalance;
                    aDataTable1.Rows[1][1] = OldCustomerAccountAmountParser;
                    aDataTable1.Rows.Add();
                    aDataTable1.Rows[2][0] = ReceiptText.RctTxtNewBalance;
                    aDataTable1.Rows[2][1] = OldCustomerAccountAmountParser + double.Parse(PaymentAmountTxtBox.Text);
                    if (double.TryParse(CurrentBalanceTxtBox.Text, out OldCustomerAccountAmountParser))
                    {
                        aDataTable1.Rows.Add();
                        aDataTable1.Rows[3][0] = ReceiptText.RctTxtCurrenctBalance;
                        aDataTable1.Rows[3][1] = OldCustomerAccountAmountParser.ToString();
                    }
                }

                aDataTableList.Add(aDataTable1);
                List <string> aStringList = ReportsHelper.ImportReportHeader(0, 0);
                List <string> aFooterList = ReportsHelper.ImportReportHeader(1, 0);
                aStringList.Add(SharedVariables.Line_Solid_10px_Black);
                aStringList.Add(ReceiptName.RctNmsCustomerPay);
                aStringList.Add(ReceiptText.RctTxtDuplicate);

                if (aCustomerPaymentRowGlobal["IsRevised"].ToString() == "1")
                {
                    aStringList.Add("*** " + ReceiptText.RctTxtReversed + " ***");
                    aStringList.Add("<h2> " + ReceiptText.RctTxtReversedBy + ":&nbsp;&nbsp;" + RevisedBylbl.Text + "</h2>");
                    aStringList.Add("<h2> " + ReceiptText.RctTxtReversedOn + ":&nbsp;&nbsp;" + ReviseDatelbl.Text + "</h2>");
                }

                aStringList.Add("<h2>" + ReceiptText.RctTxtOrgDate + "/" + ReceiptText.RctTxtOrgTime + " " + DateLbl.Text + "&nbsp;&nbsp;" + TimeLbl.Text + "</h2>");
                aStringList.Add("<h2> " + ReceiptText.RctTxtOrgTeller + ":&nbsp;&nbsp;" + TellerLbl.Text + "</h2>");
                aStringList.Add("<h2>" + ReceiptText.RctTxtReprintedOn + " " + DateTime.Now.ToShortDateString() + "&nbsp;&nbsp;" + DateTime.Now.ToShortTimeString() + "</h2>");
                aStringList.Add("<h2> " + ReceiptText.RctTxtReprintedBy + ":&nbsp;&nbsp;" + SharedFunctions.ReturnLoggedUserName() + "</h2>");


                aStringList.Add(ReceiptText.RctTxtCustomer + ":&nbsp;&nbsp;" + CustomerNameTxtBox.Text);
                aStringList.Add(ReceiptText.RctTxtPaymentNum + ":&nbsp; " + PaymentNumberTxtBox.Text);
                aStringList.Add(SharedVariables.Line_Solid_10px_Black);
                PrintingManager.Instance.PrintTables(aDataTableList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, true, true);
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(MsgTxt.UnexpectedError + "\n Exception: IN[EditCustomerPayment:Print Receipt [EXCEPTION IS]] \n" + ex.Message, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }