//Detail Row Block public void PrintDocumentDetail(TicketTable pTicketTable, FRBODocumentFinancePaymentDocumentView pFinancePaymentDocument, string pPaddingLeftFormat) { try { //Trim Data string documentNumber = (pFinancePaymentDocument.DocumentNumber.Length <= _maxCharsPerLineNormalBold) ? pFinancePaymentDocument.DocumentNumber : pFinancePaymentDocument.DocumentNumber.Substring(0, _maxCharsPerLineNormalBold) ; //Print Document Number : Bold _thermalPrinterGeneric.WriteLine(documentNumber, WriteLineTextMode.Bold); //Document Details DataRow dataRow; dataRow = pTicketTable.NewRow(); dataRow[0] = pFinancePaymentDocument.DocumentDate; dataRow[1] = pFinancePaymentDocument.DocumentNumber; //dataRow[2] = (item.CreditAmount > 0 && item.DocumentTotal > item.CreditAmount) // ? FrameworkUtils.DecimalToString((item.DocumentTotal - item.CreditAmount) * _documentFinancePayment.ExchangeRate) // : string.Empty; dataRow[2] = pFinancePaymentDocument.DocumentTotal * _documentFinancePayment.ExchangeRate; dataRow[3] = pFinancePaymentDocument.CreditAmount * _documentFinancePayment.ExchangeRate; dataRow[4] = (pFinancePaymentDocument.Payed) ? "*" : string.Empty; //Add DataRow to Table, Ready for Print pTicketTable.Rows.Add(dataRow); //Print Table Rows pTicketTable.Print(_thermalPrinterGeneric, WriteLineTextMode.Normal, true, pPaddingLeftFormat); } catch (Exception ex) { throw ex; } }
private void PrintDocumentDetails() { List <TicketColumn> columns = new List <TicketColumn>(); columns.Add(new TicketColumn("Designation", Resx.global_designation, 0, TicketColumnsAlign.Left)); columns.Add(new TicketColumn("Quantity", Resx.global_quantity_acronym, 8, TicketColumnsAlign.Right, typeof(decimal), "{0:0.00}")); columns.Add(new TicketColumn("UnitMeasure", Resx.global_unit_measure_acronym, 3, TicketColumnsAlign.Right)); //Prepare Table with Padding DataTable dataTable = TicketTable.InitDataTableFromTicketColumns(columns); TicketTable ticketTable = new TicketTable(dataTable, columns, _maxCharsPerLineNormal); //Print Items DataRow dataRow; foreach (FIN_DocumentOrderDetail item in _orderTicket.OrderDetail) { //Add All Rows if Normal Mode without explicit ArticlePrinter defined, or print Printer Articles for explicit defined ArticlePrinter if (!_enableArticlePrinter || _thermalPrinterGeneric.Printer == item.Article.Printer) { //Add Rows to main Ticket dataRow = ticketTable.NewRow(); dataRow[0] = item.Designation; dataRow[1] = item.Quantity; dataRow[2] = item.UnitMeasure; //Add DataRow to Table, Ready for Print ticketTable.Rows.Add(dataRow); } } //Print Table ticketTable.Print(_thermalPrinterGeneric); }
//Detail Row Block public void PrintDocumentDetail(TicketTable pTicketTable, FRBODocumentFinanceDetail pFinanceDetail, string pPaddingLeftFormat) { try { //Trim Data string designation = (pFinanceDetail.Designation.Length <= _maxCharsPerLineNormalBold) ? pFinanceDetail.Designation : pFinanceDetail.Designation.Substring(0, _maxCharsPerLineNormalBold) ; //Print Item Designation : Bold _thermalPrinterGeneric.WriteLine(designation, WriteLineTextMode.Bold); //Prepare ExemptionReason string exemptionReason = string.Empty; if (pFinanceDetail.VatExemptionReasonDesignation != null && pFinanceDetail.VatExemptionReasonDesignation != string.Empty) { //Replaced Code : Remove Cut Exception Reason......its better not to cut VatExemptionReason..... //exemptionReason = (pFinanceDetail.VatExemptionReasonDesignation.Length <= pTicketTable.TableWidth) // ? pFinanceDetail.VatExemptionReasonDesignation // : pFinanceDetail.VatExemptionReasonDesignation.Substring(0, pTicketTable.TableWidth) //; //Replace Code exemptionReason = pFinanceDetail.VatExemptionReasonDesignation; //Always Format Data, its appens in first line only exemptionReason = string.Format(pPaddingLeftFormat, exemptionReason); } //Item Details DataRow dataRow = pTicketTable.NewRow(); dataRow[0] = pFinanceDetail.Vat; dataRow[1] = pFinanceDetail.Quantity; dataRow[2] = pFinanceDetail.UnitMeasure; dataRow[3] = pFinanceDetail.Price * _documentFinanceMasterList[0].ExchangeRate; dataRow[4] = pFinanceDetail.Discount; //dataRow[5] = pFinanceDetail.TotalNet * _documentFinanceMasterList[0].ExchangeRate; dataRow[5] = pFinanceDetail.TotalFinal * _documentFinanceMasterList[0].ExchangeRate; //Add DataRow to Table, Ready for Print pTicketTable.Rows.Add(dataRow); //Print Table Rows pTicketTable.Print(_thermalPrinterGeneric, WriteLineTextMode.Normal, true, pPaddingLeftFormat); //VatExemptionReason if (!string.IsNullOrEmpty(exemptionReason)) { _thermalPrinterGeneric.WriteLine(exemptionReason); } } catch (Exception ex) { throw ex; } }
//Detail Row Block public void PrintDocumentDetail(TicketTable pTicketTable, FRBODocumentFinanceDetail pFinanceDetail, string pPaddingLeftFormat) { try { //Trim Data string designation = (pFinanceDetail.Designation.Length <= _maxCharsPerLineNormalBold) ? pFinanceDetail.Designation : pFinanceDetail.Designation.Substring(0, _maxCharsPerLineNormalBold) ; //Print Item Designation : Bold _thermalPrinterGeneric.WriteLine(designation, WriteLineTextMode.Bold); //Prepare ExemptionReason string exemptionReason = string.Empty; if (!string.IsNullOrEmpty(pFinanceDetail.VatExemptionReasonDesignation)) { //Replaced Code : Remove Cut Exception Reason......its better not to cut VatExemptionReason..... //exemptionReason = (pFinanceDetail.VatExemptionReasonDesignation.Length <= pTicketTable.TableWidth) // ? pFinanceDetail.VatExemptionReasonDesignation // : pFinanceDetail.VatExemptionReasonDesignation.Substring(0, pTicketTable.TableWidth) //; //Replace Code exemptionReason = pFinanceDetail.VatExemptionReasonDesignation; //Always Format Data, its appens in first line only exemptionReason = string.Format(pPaddingLeftFormat, exemptionReason); } //Item Details DataRow dataRow = pTicketTable.NewRow(); /* IN009211 block - begin * Method "FrameworkUtils.DecimalToString(pFinanceDetail.Vat)" is safe for "%" format */ dataRow[0] = pFinanceDetail.Vat; dataRow[1] = pFinanceDetail.Quantity; dataRow[2] = pFinanceDetail.UnitMeasure; dataRow[3] = pFinanceDetail.Price * _documentFinanceMasterList[0].ExchangeRate; dataRow[4] = pFinanceDetail.Discount; //dataRow[5] = pFinanceDetail.TotalNet * _documentFinanceMasterList[0].ExchangeRate; /* fix for item total before CustomerDiscount: (TotalGross - ItemDiscount) + ItemVAT */ Decimal amountItemDiscount = pFinanceDetail.TotalGross * pFinanceDetail.Discount / 100; Decimal amountDueBeforeTax = (pFinanceDetail.TotalGross - amountItemDiscount); Decimal totalItemTax = amountDueBeforeTax * pFinanceDetail.Vat / 100; Decimal amountDueAfterTax = amountDueBeforeTax + totalItemTax; dataRow[5] = _documentFinanceMasterList[0].ExchangeRate * amountDueAfterTax; /* IN009211 block - end */ //Add DataRow to Table, Ready for Print pTicketTable.Rows.Add(dataRow); //Print Table Rows pTicketTable.Print(_thermalPrinterGeneric, WriteLineTextMode.Normal, true, pPaddingLeftFormat); //VatExemptionReason _thermalPrinterGeneric.WriteLine(exemptionReason, WriteLineTextMode.Small); /* IN009211 - WriteLine() already checks for empties and nulls */ } catch (Exception ex) { _log.Debug("void PrintDocumentDetail(TicketTable pTicketTable, FRBODocumentFinanceDetail pFinanceDetail, string pPaddingLeftFormat) :: Thermal Printer: " + ex.Message, ex); throw ex; } }