public void PrintForDotMatrix(decimal decServiceMasterId) { try { DataTable dtblOtherDetails = new DataTable(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); dtblOtherDetails = bllCompanyCreation.CompanyViewForDotMatrix(); //-------------Grid Details-------------------\\ DataTable dtblGridDetails = new DataTable(); dtblGridDetails.Columns.Add("SlNo"); dtblGridDetails.Columns.Add("Particulars"); dtblGridDetails.Columns.Add("Measure"); dtblGridDetails.Columns.Add("Amount"); int inRowCount = 0; foreach (DataGridViewRow dRow in dgvServiceVoucher.Rows) { if (dRow.HeaderCell.Value != null && dRow.HeaderCell.Value.ToString() != "X") { if (!dRow.IsNewRow) { DataRow dr = dtblGridDetails.NewRow(); dr["SlNo"] = ++inRowCount; dr["Particulars"] = dRow.Cells["dgvcmbParticulars"].FormattedValue.ToString(); dr["Amount"] = dRow.Cells["dgvtxtAmount"].Value.ToString(); dr["Measure"] = dRow.Cells["dgvtxtMeasure"].FormattedValue.ToString(); dtblGridDetails.Rows.Add(dr); } } } //-------------Other Details-------------------\\ dtblOtherDetails.Columns.Add("InvoiceNo"); dtblOtherDetails.Columns.Add("date"); dtblOtherDetails.Columns.Add("CashOrParty"); dtblOtherDetails.Columns.Add("CreditPeriod"); dtblOtherDetails.Columns.Add("Currency"); dtblOtherDetails.Columns.Add("SalesMan"); dtblOtherDetails.Columns.Add("CustomerName"); dtblOtherDetails.Columns.Add("totalAmount"); dtblOtherDetails.Columns.Add("DiscountAmount"); dtblOtherDetails.Columns.Add("GrandTotal"); dtblOtherDetails.Columns.Add("Narration"); dtblOtherDetails.Columns.Add("AmountInWords"); dtblOtherDetails.Columns.Add("Declaration"); dtblOtherDetails.Columns.Add("Heading1"); dtblOtherDetails.Columns.Add("Heading2"); dtblOtherDetails.Columns.Add("Heading3"); dtblOtherDetails.Columns.Add("Heading4"); DataRow dRowOther = dtblOtherDetails.Rows[0]; dRowOther["InvoiceNo"] = txtInvoiceNumber.Text; dRowOther["date"] = txtVoucherDate.Text; dRowOther["CashOrParty"] = cmbCashParty.Text; dRowOther["CreditPeriod"] = txtCreditPeriod.Text; dRowOther["Currency"] = cmbCurrency.Text; dRowOther["SalesMan"] = cmbSalesman.Text; dRowOther["CustomerName"] = txtCustomer.Text; dRowOther["totalAmount"] = txtTotalAmount.Text; dRowOther["DiscountAmount"] = txtDiscount.Text; dRowOther["GrandTotal"] = txtGrandTotal.Text; dRowOther["Narration"] = txtNarration.Text; dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", ""); dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtGrandTotal.Text), PublicVariables._decCurrencyId); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); DataTable dtblDeclaration = BllVoucherType.DeclarationAndHeadingGetByVoucherTypeId(DecServicetVoucherTypeId); dRowOther["Declaration"] = dtblDeclaration.Rows[0]["Declaration"].ToString(); dRowOther["Heading1"] = dtblDeclaration.Rows[0]["Heading1"].ToString(); dRowOther["Heading2"] = dtblDeclaration.Rows[0]["Heading2"].ToString(); dRowOther["Heading3"] = dtblDeclaration.Rows[0]["Heading3"].ToString(); dRowOther["Heading4"] = dtblDeclaration.Rows[0]["Heading4"].ToString(); int inFormId = BllVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString())); PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails); } catch (Exception ex) { MessageBox.Show("SV 26 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Print function for Dotmatrix Printer /// </summary> /// <param name="decMasterId"></param> public void PrintForDotMatrix(decimal decMasterId) { try { DataTable dtblOtherDetails = new DataTable(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); dtblOtherDetails = bllCompanyCreation.CompanyViewForDotMatrix(); DataTable dtblGridDetails = new DataTable(); dtblGridDetails.Columns.Add("SlNo"); dtblGridDetails.Columns.Add("BankAccount"); dtblGridDetails.Columns.Add("ChequeNo"); dtblGridDetails.Columns.Add("ChequeDate"); dtblGridDetails.Columns.Add("Amount"); DataRow dr = dtblGridDetails.NewRow(); dr["SlNo"] = 1; dr["ChequeNo"] = txtcheckNo.Text; dr["BankAccount"] = cmbBank.Text; dr["ChequeDate"] = txtCheckDate.Text; dr["Amount"] = txtAmount.Text; dtblGridDetails.Rows.Add(dr); dtblOtherDetails.Columns.Add("voucherNo"); dtblOtherDetails.Columns.Add("date"); dtblOtherDetails.Columns.Add("ledgerName"); dtblOtherDetails.Columns.Add("Narration"); dtblOtherDetails.Columns.Add("TotalAmount"); dtblOtherDetails.Columns.Add("AmountInWords"); dtblOtherDetails.Columns.Add("Declaration"); dtblOtherDetails.Columns.Add("Heading1"); dtblOtherDetails.Columns.Add("Heading2"); dtblOtherDetails.Columns.Add("Heading3"); dtblOtherDetails.Columns.Add("Heading4"); dtblOtherDetails.Columns.Add("CustomerAddress"); DataRow dRowOther = dtblOtherDetails.Rows[0]; dRowOther["voucherNo"] = txtVoucherNo.Text; dRowOther["date"] = txtVoucherDate.Text; dRowOther["ledgerName"] = cmbAccountLedger.Text; dRowOther["Narration"] = txtNarration.Text; dRowOther["TotalAmount"] = txtAmount.Text; dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", ""); AccountLedgerBll bllAccountLedger = new AccountLedgerBll(); AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo(); infoAccountLedger = bllAccountLedger.AccountLedgerView(Convert.ToDecimal(cmbAccountLedger.SelectedValue)); dRowOther["CustomerAddress"] = (infoAccountLedger.Address.ToString().Replace("\n", ", ")).Replace("\r", ""); string s = new NumToText().AmountWords(Convert.ToDecimal(txtAmount.Text), PublicVariables._decCurrencyId); dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtAmount.Text), PublicVariables._decCurrencyId); VoucherTypeBll BllVOucherType = new VoucherTypeBll(); DataTable dtblDeclaration = BllVOucherType.DeclarationAndHeadingGetByVoucherTypeId(decPDCReceivableVoucherTypeId); dRowOther["Declaration"] = dtblDeclaration.Rows[0]["Declaration"].ToString(); dRowOther["Heading1"] = dtblDeclaration.Rows[0]["Heading1"].ToString(); dRowOther["Heading2"] = dtblDeclaration.Rows[0]["Heading2"].ToString(); dRowOther["Heading3"] = dtblDeclaration.Rows[0]["Heading3"].ToString(); dRowOther["Heading4"] = dtblDeclaration.Rows[0]["Heading4"].ToString(); int inFormId = BllVOucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString())); PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails); } catch (Exception ex) { MessageBox.Show("PR22:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Adding columns to print /// </summary> /// <param name="decDeliveryNoteMasterId"></param> public void PrintForDotMatrix(decimal decDeliveryNoteMasterId) { try { DataTable dtblOtherDetails = new DataTable(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); dtblOtherDetails = bllCompanyCreation.CompanyViewForDotMatrix(); //-------------Grid Details-------------------\\ DataTable dtblGridDetails = new DataTable(); dtblGridDetails.Columns.Add("SlNo"); dtblGridDetails.Columns.Add("BarCode"); dtblGridDetails.Columns.Add("ProductCode"); dtblGridDetails.Columns.Add("ProductName"); dtblGridDetails.Columns.Add("Qty"); dtblGridDetails.Columns.Add("Unit"); dtblGridDetails.Columns.Add("Godown"); dtblGridDetails.Columns.Add("Rack"); dtblGridDetails.Columns.Add("Batch"); dtblGridDetails.Columns.Add("Rate"); dtblGridDetails.Columns.Add("Amount"); int inRowCount = 0; foreach (DataGridViewRow dRow in dgvProduct.Rows) { if (!dRow.IsNewRow) { DataRow dr = dtblGridDetails.NewRow(); dr["SlNo"] = ++inRowCount; if (dRow.Cells["dgvtxtBarcode"].Value != null) { dr["BarCode"] = dRow.Cells["dgvtxtBarcode"].Value.ToString(); } if (dRow.Cells["dgvtxtProductCode"].Value != null) { dr["ProductCode"] = dRow.Cells["dgvtxtProductCode"].Value.ToString(); } if (dRow.Cells["dgvtxtProductName"].Value != null) { dr["ProductName"] = dRow.Cells["dgvtxtProductName"].Value.ToString(); } if (dRow.Cells["dgvtxtQty"].Value != null) { dr["Qty"] = dRow.Cells["dgvtxtQty"].Value.ToString(); } if (dRow.Cells["dgvcmbUnit"].Value != null) { dr["Unit"] = dRow.Cells["dgvcmbUnit"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbGodown"].Value != null) { dr["Godown"] = dRow.Cells["dgvcmbGodown"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbRack"].Value != null) { dr["Rack"] = dRow.Cells["dgvcmbRack"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbBatch"].Value != null) { dr["Batch"] = dRow.Cells["dgvcmbBatch"].FormattedValue.ToString(); } if (dRow.Cells["dgvtxtRate"].Value != null) { dr["Rate"] = dRow.Cells["dgvtxtRate"].Value.ToString(); } if (dRow.Cells["dgvtxtAmount"].Value != null) { dr["Amount"] = dRow.Cells["dgvtxtAmount"].Value.ToString(); } dtblGridDetails.Rows.Add(dr); } } //-------------Other Details-------------------\\ dtblOtherDetails.Columns.Add("voucherNo"); dtblOtherDetails.Columns.Add("date"); dtblOtherDetails.Columns.Add("ledgerName"); dtblOtherDetails.Columns.Add("Narration"); dtblOtherDetails.Columns.Add("Currency"); dtblOtherDetails.Columns.Add("TotalAmount"); dtblOtherDetails.Columns.Add("DeliveryMode"); dtblOtherDetails.Columns.Add("PricingLevel"); dtblOtherDetails.Columns.Add("Type"); dtblOtherDetails.Columns.Add("SalesMan"); dtblOtherDetails.Columns.Add("CustomerAddress"); dtblOtherDetails.Columns.Add("CustomerTIN"); dtblOtherDetails.Columns.Add("CustomerCST"); dtblOtherDetails.Columns.Add("AmountInWords"); dtblOtherDetails.Columns.Add("Declaration"); dtblOtherDetails.Columns.Add("Heading1"); dtblOtherDetails.Columns.Add("Heading2"); dtblOtherDetails.Columns.Add("Heading3"); dtblOtherDetails.Columns.Add("Heading4"); DataRow dRowOther = dtblOtherDetails.Rows[0]; dRowOther["voucherNo"] = txtDeliveryNoteNo.Text; dRowOther["date"] = txtDate.Text; dRowOther["ledgerName"] = cmbCashOrParty.Text; dRowOther["Narration"] = txtNarration.Text; dRowOther["Currency"] = cmbCurrency.Text; dRowOther["TotalAmount"] = txtTotalAmnt.Text; dRowOther["DeliveryMode"] = cmbDeliveryMode.Text; dRowOther["PricingLevel"] = cmbPricingLevel.Text; dRowOther["Type"] = cmbType.Text; dRowOther["SalesMan"] = cmbSalesMan.Text; dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", ""); AccountLedgerBll bllAccountLedger = new AccountLedgerBll(); AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo(); infoAccountLedger = bllAccountLedger.AccountLedgerView(Convert.ToDecimal(cmbCashOrParty.SelectedValue)); dRowOther["CustomerAddress"] = (infoAccountLedger.Address.ToString().Replace("\n", ", ")).Replace("\r", ""); dRowOther["CustomerTIN"] = infoAccountLedger.Tin; dRowOther["CustomerCST"] = infoAccountLedger.Cst; dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtTotalAmnt.Text), PublicVariables._decCurrencyId); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); DataTable dtblDeclaration = BllVoucherType.DeclarationAndHeadingGetByVoucherTypeId(decDeliveryNoteVoucherTypeId); dRowOther["Declaration"] = dtblDeclaration.Rows[0]["Declaration"].ToString(); dRowOther["Heading1"] = dtblDeclaration.Rows[0]["Heading1"].ToString(); dRowOther["Heading2"] = dtblDeclaration.Rows[0]["Heading2"].ToString(); dRowOther["Heading3"] = dtblDeclaration.Rows[0]["Heading3"].ToString(); dRowOther["Heading4"] = dtblDeclaration.Rows[0]["Heading4"].ToString(); int inFormId = BllVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString())); PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails); } catch (Exception ex) { MessageBox.Show("DN41:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Dotmatrix print function add the details to fill here /// </summary> /// <param name="decPaymentMasterId"></param> public void PrintForDotMatrix(decimal decPaymentMasterId) { try { DataTable dtblOtherDetails = new DataTable(); CompanySP spComapany = new CompanySP(); dtblOtherDetails = spComapany.CompanyViewForDotMatrix(); DataTable dtblGridDetails = new DataTable(); dtblGridDetails.Columns.Add("SlNo"); dtblGridDetails.Columns.Add("Account Ledger"); dtblGridDetails.Columns.Add("Amount"); dtblGridDetails.Columns.Add("Currency"); dtblGridDetails.Columns.Add("Cheque No"); dtblGridDetails.Columns.Add("Cheque Date"); int inRowCount = 0; foreach (DataGridViewRow dRow in dgvPaymentVoucher.Rows) { if (dRow.HeaderCell.Value != null && dRow.HeaderCell.Value.ToString() != "X") { if (!dRow.IsNewRow) { DataRow dr = dtblGridDetails.NewRow(); dr["SlNo"] = ++inRowCount; dr["Account Ledger"] = dRow.Cells["dgvcmbAccountLedger"].FormattedValue.ToString(); dr["Amount"] = dRow.Cells["dgvtxtAmount"].Value.ToString(); dr["Currency"] = dRow.Cells["dgvcmbCurrency"].FormattedValue.ToString(); dr["Cheque No"] = (dRow.Cells["dgvtxtChequeNo"].Value == null ? "" : dRow.Cells["dgvtxtChequeNo"].Value.ToString()); dr["Cheque Date"] = (dRow.Cells["dgvtxtChequeDate"].Value == null ? "" : dRow.Cells["dgvtxtChequeDate"].Value.ToString()); dtblGridDetails.Rows.Add(dr); } } } dtblOtherDetails.Columns.Add("voucherNo"); dtblOtherDetails.Columns.Add("date"); dtblOtherDetails.Columns.Add("totalAmount"); dtblOtherDetails.Columns.Add("ledgerName"); dtblOtherDetails.Columns.Add("Narration"); dtblOtherDetails.Columns.Add("AmountInWords"); dtblOtherDetails.Columns.Add("Declaration"); dtblOtherDetails.Columns.Add("Heading1"); dtblOtherDetails.Columns.Add("Heading2"); dtblOtherDetails.Columns.Add("Heading3"); dtblOtherDetails.Columns.Add("Heading4"); DataRow dRowOther = dtblOtherDetails.Rows[0]; dRowOther["voucherNo"] = txtVoucherNo.Text; dRowOther["date"] = txtDate.Text; dRowOther["totalAmount"] = txtTotal.Text; dRowOther["ledgerName"] = cmbBankorCash.Text; dRowOther["Narration"] = txtNarration.Text; dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtTotal.Text), PublicVariables._decCurrencyId); dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", ""); VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblDeclaration = spVoucherType.DeclarationAndHeadingGetByVoucherTypeId(decPaymentVoucherTypeId); dRowOther["Declaration"] = dtblDeclaration.Rows[0]["Declaration"].ToString(); dRowOther["Heading1"] = dtblDeclaration.Rows[0]["Heading1"].ToString(); dRowOther["Heading2"] = dtblDeclaration.Rows[0]["Heading2"].ToString(); dRowOther["Heading3"] = dtblDeclaration.Rows[0]["Heading3"].ToString(); dRowOther["Heading4"] = dtblDeclaration.Rows[0]["Heading4"].ToString(); int inFormId = spVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString())); PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails); } catch (Exception ex) { MessageBox.Show("PV:11" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Print function for dotmatrix printer /// </summary> /// <param name="decContraMasterId"></param> public void PrintForDotMatrix(decimal decContraMasterId) { try { DataTable dtblOtherDetails = new DataTable(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); dtblOtherDetails = bllCompanyCreation.CompanyViewForDotMatrix(); //-------------Grid Details-------------------\\ DataTable dtblGridDetails = new DataTable(); dtblGridDetails.Columns.Add("SlNo"); dtblGridDetails.Columns.Add("CashOrBankGrid"); dtblGridDetails.Columns.Add("Amount"); dtblGridDetails.Columns.Add("Currency"); dtblGridDetails.Columns.Add("Cheque No"); dtblGridDetails.Columns.Add("Cheque Date"); int inRowCount = 0; foreach (DataGridViewRow dRow in dgvContraVoucher.Rows) { if (!dRow.IsNewRow) { DataRow dr = dtblGridDetails.NewRow(); dr["SlNo"] = ++inRowCount; dr["CashOrBankGrid"] = dRow.Cells["dgvcmbBankorCashAccount"].FormattedValue.ToString(); dr["Amount"] = dRow.Cells["dgvtxtAmount"].Value.ToString(); dr["Currency"] = dRow.Cells["dgvcmbCurrency"].FormattedValue.ToString(); dr["Cheque No"] = (dRow.Cells["dgvtxtChequeNo"].Value == null ? "" : dRow.Cells["dgvtxtChequeNo"].Value.ToString()); dr["Cheque Date"] = (dRow.Cells["dgvtxtChequeDate"].Value == null ? "" : dRow.Cells["dgvtxtChequeDate"].Value.ToString()); dtblGridDetails.Rows.Add(dr); } } //-------------Other Details-------------------\\ dtblOtherDetails.Columns.Add("voucherNo"); dtblOtherDetails.Columns.Add("date"); dtblOtherDetails.Columns.Add("totalAmount"); dtblOtherDetails.Columns.Add("CashOrBank"); dtblOtherDetails.Columns.Add("Narration"); dtblOtherDetails.Columns.Add("Type"); dtblOtherDetails.Columns.Add("AmountInWords"); dtblOtherDetails.Columns.Add("Declaration"); dtblOtherDetails.Columns.Add("Heading1"); dtblOtherDetails.Columns.Add("Heading2"); dtblOtherDetails.Columns.Add("Heading3"); dtblOtherDetails.Columns.Add("Heading4"); DataRow dRowOther = dtblOtherDetails.Rows[0]; dRowOther["voucherNo"] = txtVoucherNo.Text; dRowOther["date"] = txtContraVoucherDate.Text; dRowOther["totalAmount"] = txtTotal.Text; dRowOther["CashOrBank"] = cmbBankAccount.Text; dRowOther["Narration"] = txtNarration.Text; dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", ""); if (rbtnDeposit.Checked) { dRowOther["Type"] = "Deposit"; } else { dRowOther["Type"] = "Withdraw"; } dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtTotal.Text), PublicVariables._decCurrencyId); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); DataTable dtblDeclaration = BllVoucherType.DeclarationAndHeadingGetByVoucherTypeId(DecContraVoucherTypeId); dRowOther["Declaration"] = dtblDeclaration.Rows[0]["Declaration"].ToString(); dRowOther["Heading1"] = dtblDeclaration.Rows[0]["Heading1"].ToString(); dRowOther["Heading2"] = dtblDeclaration.Rows[0]["Heading2"].ToString(); dRowOther["Heading3"] = dtblDeclaration.Rows[0]["Heading3"].ToString(); dRowOther["Heading4"] = dtblDeclaration.Rows[0]["Heading4"].ToString(); int inFormId = BllVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString())); PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails); } catch (Exception ex) { MessageBox.Show("CV:27" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// print function for dotmatrix printer /// </summary> /// <param name="decPhysicalStockMasterId"></param> public void PrintForDotMatrix(decimal decPhysicalStockMasterId) { try { DataTable dtblOtherDetails = new DataTable(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); dtblOtherDetails = bllCompanyCreation.CompanyViewForDotMatrix(); DataTable dtblGridDetails = new DataTable(); dtblGridDetails.Columns.Add("SlNo"); dtblGridDetails.Columns.Add("BarCode"); dtblGridDetails.Columns.Add("ProductCode"); dtblGridDetails.Columns.Add("ProductName"); dtblGridDetails.Columns.Add("Qty"); dtblGridDetails.Columns.Add("Unit"); dtblGridDetails.Columns.Add("Godown"); dtblGridDetails.Columns.Add("Rack"); dtblGridDetails.Columns.Add("Batch"); dtblGridDetails.Columns.Add("Rate"); dtblGridDetails.Columns.Add("Amount"); int inRowCount = 0; foreach (DataGridViewRow dRow in dgvPhysicalStock.Rows) { if (!dRow.IsNewRow) { DataRow dr = dtblGridDetails.NewRow(); dr["SlNo"] = ++inRowCount; if (dRow.Cells["dgvtxtBarcode"].Value != null) { dr["BarCode"] = dRow.Cells["dgvtxtBarcode"].Value.ToString(); } if (dRow.Cells["dgvtxtProductCode"].Value != null) { dr["ProductCode"] = dRow.Cells["dgvtxtProductCode"].Value.ToString(); } if (dRow.Cells["dgvtxtProductName"].Value != null) { dr["ProductName"] = dRow.Cells["dgvtxtProductName"].Value.ToString(); } if (dRow.Cells["dgvtxtQty"].Value != null) { dr["Qty"] = dRow.Cells["dgvtxtQty"].Value.ToString(); } if (dRow.Cells["dgvcmbUnit"].Value != null) { dr["Unit"] = dRow.Cells["dgvcmbUnit"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbGodown"].Value != null) { dr["Godown"] = dRow.Cells["dgvcmbGodown"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbRack"].Value != null) { dr["Rack"] = dRow.Cells["dgvcmbRack"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbBatch"].Value != null) { dr["Batch"] = dRow.Cells["dgvcmbBatch"].FormattedValue.ToString(); } if (dRow.Cells["dgvtxtRate"].Value != null) { dr["Rate"] = dRow.Cells["dgvtxtRate"].Value.ToString(); } if (dRow.Cells["dgvtxtAmount"].Value != null) { dr["Amount"] = dRow.Cells["dgvtxtAmount"].Value.ToString(); } dtblGridDetails.Rows.Add(dr); } } dtblOtherDetails.Columns.Add("voucherNo"); dtblOtherDetails.Columns.Add("date"); dtblOtherDetails.Columns.Add("Narration"); dtblOtherDetails.Columns.Add("TotalAmount"); dtblOtherDetails.Columns.Add("AmountInWords"); dtblOtherDetails.Columns.Add("Declaration"); dtblOtherDetails.Columns.Add("Heading1"); dtblOtherDetails.Columns.Add("Heading2"); dtblOtherDetails.Columns.Add("Heading3"); dtblOtherDetails.Columns.Add("Heading4"); DataRow dRowOther = dtblOtherDetails.Rows[0]; dRowOther["voucherNo"] = txtVoucherNo.Text; dRowOther["date"] = txtDate.Text; dRowOther["Narration"] = txtNarration.Text; dRowOther["TotalAmount"] = txtTotalAmount.Text; dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", ""); dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtTotalAmount.Text), PublicVariables._decCurrencyId); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); DataTable dtblDeclaration = BllVoucherType.DeclarationAndHeadingGetByVoucherTypeId(decPhysicalStockVoucherTypeId); dRowOther["Declaration"] = dtblDeclaration.Rows[0]["Declaration"].ToString(); dRowOther["Heading1"] = dtblDeclaration.Rows[0]["Heading1"].ToString(); dRowOther["Heading2"] = dtblDeclaration.Rows[0]["Heading2"].ToString(); dRowOther["Heading3"] = dtblDeclaration.Rows[0]["Heading3"].ToString(); dRowOther["Heading4"] = dtblDeclaration.Rows[0]["Heading4"].ToString(); int inFormId = BllVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString())); PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails); } catch (Exception ex) { MessageBox.Show("PS:3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Print function for dotmatrix printer /// </summary> /// <param name="decSalesMasterId"></param> public void PrintForDotMatrix(decimal decSalesMasterId) { try { DataTable dtblOtherDetails = new DataTable(); CompanySP spComapany = new CompanySP(); dtblOtherDetails = spComapany.CompanyViewForDotMatrix(); DataTable dtblGridDetails = new DataTable(); dtblGridDetails.Columns.Add("SlNo"); dtblGridDetails.Columns.Add("BarCode"); dtblGridDetails.Columns.Add("ProductCode"); dtblGridDetails.Columns.Add("ProductName"); dtblGridDetails.Columns.Add("Qty"); dtblGridDetails.Columns.Add("Unit"); dtblGridDetails.Columns.Add("Godown"); dtblGridDetails.Columns.Add("Brand"); dtblGridDetails.Columns.Add("Tax"); dtblGridDetails.Columns.Add("TaxAmount"); dtblGridDetails.Columns.Add("NetAmount"); dtblGridDetails.Columns.Add("DiscountAmount"); dtblGridDetails.Columns.Add("DiscountPercentage"); dtblGridDetails.Columns.Add("SalesRate"); dtblGridDetails.Columns.Add("PurchaseRate"); dtblGridDetails.Columns.Add("MRP"); dtblGridDetails.Columns.Add("Rack"); dtblGridDetails.Columns.Add("Batch"); dtblGridDetails.Columns.Add("Rate"); dtblGridDetails.Columns.Add("Amount"); int inRowCount = 0; foreach (DataGridViewRow dRow in dgvSalesInvoice.Rows) { if (!dRow.IsNewRow) { DataRow dr = dtblGridDetails.NewRow(); dr["SlNo"] = ++inRowCount; if (dRow.Cells["dgvtxtSalesInvoiceBarcode"].Value != null) { dr["BarCode"] = dRow.Cells["dgvtxtSalesInvoiceBarcode"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceProductCode"].Value != null) { dr["ProductCode"] = dRow.Cells["dgvtxtSalesInvoiceProductCode"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceProductName"].Value != null) { dr["ProductName"] = dRow.Cells["dgvtxtSalesInvoiceProductName"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceQty"].Value != null) { dr["Qty"] = dRow.Cells["dgvtxtSalesInvoiceQty"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoicembUnitName"].Value != null) { dr["Unit"] = dRow.Cells["dgvtxtSalesInvoicembUnitName"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbSalesInvoiceGodown"].Value != null) { dr["Godown"] = dRow.Cells["dgvcmbSalesInvoiceGodown"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbSalesInvoiceRack"].Value != null) { dr["Rack"] = dRow.Cells["dgvcmbSalesInvoiceRack"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbSalesInvoiceBatch"].Value != null) { dr["Batch"] = dRow.Cells["dgvcmbSalesInvoiceBatch"].FormattedValue.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceRate"].Value != null) { dr["Rate"] = dRow.Cells["dgvtxtSalesInvoiceRate"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceAmount"].Value != null) { dr["Amount"] = dRow.Cells["dgvtxtSalesInvoiceAmount"].Value.ToString(); } if (dRow.Cells["dgvcmbSalesInvoiceTaxName"].Value != null) { dr["Tax"] = dRow.Cells["dgvcmbSalesInvoiceTaxName"].FormattedValue.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceBrand"].Value != null) { dr["Brand"] = dRow.Cells["dgvtxtSalesInvoiceBrand"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceTaxAmount"].Value != null) { dr["TaxAmount"] = dRow.Cells["dgvtxtSalesInvoiceTaxAmount"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceNetAmount"].Value != null) { dr["NetAmount"] = dRow.Cells["dgvtxtSalesInvoiceNetAmount"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceDiscountAmount"].Value != null) { dr["DiscountAmount"] = dRow.Cells["dgvtxtSalesInvoiceDiscountAmount"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceDiscountPercentage"].Value != null) { dr["DiscountPercentage"] = dRow.Cells["dgvtxtSalesInvoiceDiscountPercentage"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceSalesRate"].Value != null) { dr["SalesRate"] = dRow.Cells["dgvtxtSalesInvoiceSalesRate"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoicePurchaseRate"].Value != null) { dr["PurchaseRate"] = dRow.Cells["dgvtxtSalesInvoicePurchaseRate"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceMrp"].Value != null) { dr["MRP"] = dRow.Cells["dgvtxtSalesInvoiceMrp"].Value.ToString(); } dtblGridDetails.Rows.Add(dr); } } dtblOtherDetails.Columns.Add("voucherNo"); dtblOtherDetails.Columns.Add("date"); dtblOtherDetails.Columns.Add("ledgerName"); dtblOtherDetails.Columns.Add("SalesMode"); dtblOtherDetails.Columns.Add("SalesAccount"); dtblOtherDetails.Columns.Add("SalesMan"); dtblOtherDetails.Columns.Add("CreditPeriod"); dtblOtherDetails.Columns.Add("VoucherType"); dtblOtherDetails.Columns.Add("PricingLevel"); dtblOtherDetails.Columns.Add("Customer"); dtblOtherDetails.Columns.Add("CustomerAddress"); dtblOtherDetails.Columns.Add("CustomerTIN"); dtblOtherDetails.Columns.Add("CustomerCST"); dtblOtherDetails.Columns.Add("Narration"); dtblOtherDetails.Columns.Add("Currency"); dtblOtherDetails.Columns.Add("TotalAmount"); dtblOtherDetails.Columns.Add("BillDiscount"); dtblOtherDetails.Columns.Add("GrandTotal"); dtblOtherDetails.Columns.Add("AmountInWords"); dtblOtherDetails.Columns.Add("Declaration"); dtblOtherDetails.Columns.Add("Heading1"); dtblOtherDetails.Columns.Add("Heading2"); dtblOtherDetails.Columns.Add("Heading3"); dtblOtherDetails.Columns.Add("Heading4"); DataRow dRowOther = dtblOtherDetails.Rows[0]; dRowOther["voucherNo"] = txtInvoiceNo.Text; dRowOther["date"] = txtDate.Text; dRowOther["ledgerName"] = cmbCashOrParty.Text; dRowOther["Narration"] = txtNarration.Text; dRowOther["Currency"] = cmbCurrency.Text; dRowOther["SalesMode"] = cmbSalesMode.Text; dRowOther["SalesAccount"] = cmbSalesAccount.Text; dRowOther["SalesMan"] = cmbSalesMan.SelectedText; dRowOther["CreditPeriod"] = (txtCreditPeriod.Text) + " Days"; dRowOther["PricingLevel"] = cmbPricingLevel.Text; dRowOther["Customer"] = txtCustomer.Text; dRowOther["BillDiscount"] = txtBillDiscount.Text; dRowOther["GrandTotal"] = txtGrandTotal.Text; dRowOther["TotalAmount"] = txtTotalAmount.Text; dRowOther["VoucherType"] = cmbVoucherType.Text; dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", ""); AccountLedgerSP spAccountLedger = new AccountLedgerSP(); AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo(); infoAccountLedger = spAccountLedger.AccountLedgerView(Convert.ToDecimal(cmbCashOrParty.SelectedValue)); dRowOther["CustomerAddress"] = (infoAccountLedger.Address.ToString().Replace("\n", ", ")).Replace("\r", ""); dRowOther["CustomerTIN"] = infoAccountLedger.Tin; dRowOther["CustomerCST"] = infoAccountLedger.Cst; dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtGrandTotal.Text), PublicVariables._decCurrencyId); VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblDeclaration = spVoucherType.DeclarationAndHeadingGetByVoucherTypeId(DecSalesInvoiceVoucherTypeId); dRowOther["Declaration"] = dtblDeclaration.Rows[0]["Declaration"].ToString(); dRowOther["Heading1"] = dtblDeclaration.Rows[0]["Heading1"].ToString(); dRowOther["Heading2"] = dtblDeclaration.Rows[0]["Heading2"].ToString(); dRowOther["Heading3"] = dtblDeclaration.Rows[0]["Heading3"].ToString(); dRowOther["Heading4"] = dtblDeclaration.Rows[0]["Heading4"].ToString(); int inFormId = spVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString())); PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails); } catch (Exception ex) { MessageBox.Show("SI: 74" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to print ServiceVoucher in curresponding Crystal report /// </summary> /// <param name="dsServiceVoucher"></param> internal void ServiceVoucherPrinting(DataSet dsServiceVoucher) { try { decimal decGrandTotal = 0; crptServiceVoucher crptServiceVoucher = new crptServiceVoucher(); foreach (DataTable dtbl in dsServiceVoucher.Tables) { if (dtbl.TableName == "Table") { crptServiceVoucher.Database.Tables["dtblCompanyDetails"].SetDataSource(dtbl); } else if (dtbl.TableName == "Table1") { crptServiceVoucher.Database.Tables["dtblServiceMaster"].SetDataSource(dtbl); foreach (DataRow drow in dtbl.Rows) { decGrandTotal = Convert.ToDecimal(drow["grandTotal"].ToString()); } //decimal decExchangeRateID = 0; //foreach (DataRow drow in dtbl.Rows) //{ // decExchangeRateID = Convert.ToDecimal(drow["exchangeRateId"].ToString()); //} //CurrencyInfo infoCurrency = new CurrencyInfo(); //ExchangeRateSP spExchangeRate = new ExchangeRateSP(); //infoCurrency = spExchangeRate.GetCurrencyByExchangeRateID(decExchangeRateID); //DataColumn dtClmnCurrency = new DataColumn("currency"); //dtbl.Columns.Add(dtClmnCurrency); //foreach (DataRow drowCurrency in dtbl.Rows) //{ // drowCurrency["currency"] = infoCurrency.CurrencyName; //} crptServiceVoucher.Database.Tables["dtblServiceMaster"].SetDataSource(dtbl); } else if (dtbl.TableName == "Table2") { DataColumn dtClmn = new DataColumn("AmountInWords"); dtbl.Columns.Add(dtClmn); foreach (DataRow drow in dtbl.Rows) { drow["AmountInWords"] = new NumToText().AmountWords(decGrandTotal, PublicVariables._decCurrencyId); } //decimal decExchangeRateID = 0; //foreach (DataRow drow in dtbl.Rows) //{ // decExchangeRateID = Convert.ToDecimal(drow["exchangeRateId"].ToString()); //} //CurrencyInfo infoCurrency = new CurrencyInfo(); //ExchangeRateSP spExchangeRate = new ExchangeRateSP(); //infoCurrency = spExchangeRate.GetCurrencyByExchangeRateID(decExchangeRateID); //DataColumn dtClmnCurrency = new DataColumn("currency"); //dtbl.Columns.Add(dtClmnCurrency); //foreach (DataRow drowCurrency in dtbl.Rows) //{ // drowCurrency["currency"] = infoCurrency.CurrencyName; //} DataColumn dtClmnSlNo = new DataColumn("SlNo"); dtbl.Columns.Add(dtClmnSlNo); int inRowIndex = 0; foreach (DataRow drSlNo in dtbl.Rows) { drSlNo["SlNo"] = ++inRowIndex; } crptServiceVoucher.Database.Tables["dtblServiceVoucherDetails"].SetDataSource(dtbl); } } this.crptViewer.ReportSource = crptServiceVoucher; SettingsSP spSettings = new SettingsSP(); if (spSettings.SettingsStatusCheck("DirectPrint") == "No") { base.Show(); this.BringToFront(); } else { crptServiceVoucher.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex) { MessageBox.Show("CRV8 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Its the function to print the curresponding details to the Dotmatrix printer /// </summary> /// <param name="decMasterId"></param> public void PrintForDotMatrix(decimal decMasterId) { try { DataTable dtblOtherDetails = new DataTable(); CompanySP spComapany = new CompanySP(); dtblOtherDetails = spComapany.CompanyViewForDotMatrix(); DataTable dtblGridDetails = new DataTable(); dtblGridDetails.Columns.Add("SlNo"); dtblGridDetails.Columns.Add("BankAccount"); dtblGridDetails.Columns.Add("ChequeNo"); dtblGridDetails.Columns.Add("ChequeDate"); dtblGridDetails.Columns.Add("Amount"); dtblGridDetails.Columns.Add("AccountLedger"); dtblGridDetails.Columns.Add("voucherNo"); dtblGridDetails.Columns.Add("voucherDate"); dtblGridDetails.Columns.Add("voucherType"); dtblGridDetails.Columns.Add("Narration"); dtblGridDetails.Columns.Add("againstInvoiceNo"); dtblGridDetails.Columns.Add("Status"); DataRow dr = dtblGridDetails.NewRow(); dr["SlNo"] = 1; dr["ChequeNo"] = txtcheckNo.Text; dr["BankAccount"] = txtBank.Text; dr["ChequeDate"] = txtcheckdate.Text; dr["Amount"] = txtAmount.Text; dr["AccountLedger"] = txtAccountLedger.Text; dr["voucherNo"] = txtvoucherNo.Text; dr["voucherDate"] = txtVoucherDate.Text; dr["voucherType"] = cmbvouchertype.Text; dr["Narration"] = txtNarration.Text; dr["againstInvoiceNo"] = cmbInvoiceNo.Text; dr["Status"] = cmbStatus.Text; dtblGridDetails.Rows.Add(dr); dtblOtherDetails.Columns.Add("AmountInWords"); dtblOtherDetails.Columns.Add("Declaration"); dtblOtherDetails.Columns.Add("Heading1"); dtblOtherDetails.Columns.Add("Heading2"); dtblOtherDetails.Columns.Add("Heading3"); dtblOtherDetails.Columns.Add("Heading4"); DataRow dRowOther = dtblOtherDetails.Rows[0]; dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", ""); dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtAmount.Text), PublicVariables._decCurrencyId); VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblDeclaration = spVoucherType.DeclarationAndHeadingGetByVoucherTypeId(decPDCclearanceVoucherTypeId); dRowOther["Declaration"] = dtblDeclaration.Rows[0]["Declaration"].ToString(); dRowOther["Heading1"] = dtblDeclaration.Rows[0]["Heading1"].ToString(); dRowOther["Heading2"] = dtblDeclaration.Rows[0]["Heading2"].ToString(); dRowOther["Heading3"] = dtblDeclaration.Rows[0]["Heading3"].ToString(); dRowOther["Heading4"] = dtblDeclaration.Rows[0]["Heading4"].ToString(); int inFormId = spVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString())); PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails); } catch (Exception ex) { MessageBox.Show("PC19:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to print ContraVoucher in curresponding Crystal report /// </summary> /// <param name="dsCOntraVoucher"></param> internal void ContraVoucherPrinting(DataSet dsCOntraVoucher) { try { crptContraVoucher crptContraVoucher = new crptContraVoucher(); decimal decTotalAmount = 0; foreach (DataTable dtbl in dsCOntraVoucher.Tables) { if (dtbl.TableName == "Table") { crptContraVoucher.Database.Tables["dtblCompanyDetails"].SetDataSource(dtbl); } else if (dtbl.TableName == "Table1") { foreach (DataRow drow in dtbl.Rows) { DataColumn dtClmn = new DataColumn("AmountInWords"); dtbl.Columns.Add(dtClmn); if (drow["totalAmount"].ToString() != string.Empty) { decTotalAmount = Convert.ToDecimal(drow["totalAmount"].ToString()); drow["AmountInWords"] = new NumToText().AmountWords(decTotalAmount, PublicVariables._decCurrencyId); } crptContraVoucher.Database.Tables["dtblOtherDetails"].SetDataSource(dtbl); } } else if (dtbl.TableName == "Table2") { foreach (DataRow drow in dtbl.Rows) { if (drow["chequeDate"].ToString() == "01 Jan 1753") { drow["chequeDate"] = string.Empty; } } DataColumn dtClmnSlNo = new DataColumn("SlNo"); dtbl.Columns.Add(dtClmnSlNo); int inRowIndex = 0; foreach (DataRow drSlNo in dtbl.Rows) { drSlNo["SlNo"] = ++inRowIndex; } crptContraVoucher.Database.Tables["dtblGridDetails"].SetDataSource(dtbl); } } this.crptViewer.ReportSource = crptContraVoucher; SettingsSP spSettings = new SettingsSP(); if (spSettings.SettingsStatusCheck("DirectPrint") == "No") { base.Show(); this.BringToFront(); } else { crptContraVoucher.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex) { MessageBox.Show("CRV5 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to print JournalVoucher in curresponding Crystal report /// </summary> /// <param name="dsJournalVoucher"></param> internal void JournalVoucherPrinting(DataSet dsJournalVoucher) { try { crptJournalVoucher crptJournalVoucher = new crptJournalVoucher(); decimal decTotalAmount = 0; foreach (DataTable dtbl in dsJournalVoucher.Tables) { if (dtbl.TableName == "Table") { crptJournalVoucher.Database.Tables["dtblCompany"].SetDataSource(dtbl); } else if (dtbl.TableName == "Table1") { foreach (DataRow drow in dtbl.Rows) { DataColumn dtClmn = new DataColumn("Amount In Words"); dtbl.Columns.Add(dtClmn); if (drow["totalAmount"].ToString() != string.Empty) { decTotalAmount = Convert.ToDecimal(drow["totalAmount"].ToString()); drow["Amount In Words"] = new NumToText().AmountWords(decTotalAmount, PublicVariables._decCurrencyId); } crptJournalVoucher.Database.Tables["dtblJournalMaster"].SetDataSource(dtbl); } } else if (dtbl.TableName == "Table2") { DataColumn dtClmn = new DataColumn("CreditOrDebit"); dtbl.Columns.Add(dtClmn); DataColumn dtClmn1 = new DataColumn("Amount"); dtbl.Columns.Add(dtClmn1); foreach (DataRow drow in dtbl.Rows) { if (drow["chequeNo"].ToString() == string.Empty) { drow["chequeDate"] = string.Empty; } if (Convert.ToDecimal(drow["debit"].ToString()) == 0) { drow["Amount"] = Convert.ToDecimal(drow["credit"].ToString()); drow["CreditOrDebit"] = "Cr"; } else { drow["Amount"] = Convert.ToDecimal(drow["debit"].ToString()); drow["CreditOrDebit"] = "Dr"; } } crptJournalVoucher.Database.Tables["dtblJournalDetails"].SetDataSource(dtbl); } } this.crptViewer.ReportSource = crptJournalVoucher; SettingsSP spSettings = new SettingsSP(); if (spSettings.SettingsStatusCheck("DirectPrint") == "No") { base.Show(); this.BringToFront(); } else { crptJournalVoucher.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex) { MessageBox.Show("CRV7" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to print PDCreceivableVoucher in curresponding Crystal report /// </summary> /// <param name="dspdcreceivablePrinting"></param> internal void PDCreceivableVoucherPrinting(DataSet dspdcreceivablePrinting) { try { crptPDCreceivable crptPdcReceivable = new crptPDCreceivable(); decimal decTotalAmount = 0; foreach (DataTable dtbl in dspdcreceivablePrinting.Tables) { if (dtbl.TableName == "Table") { crptPdcReceivable.Database.Tables["dtblCompany"].SetDataSource(dtbl); } else if (dtbl.TableName == "Table1") { foreach (DataRow drow in dtbl.Rows) { DataColumn dtClmn = new DataColumn("AmountInWords"); dtbl.Columns.Add(dtClmn); if (drow["Amount"].ToString() != string.Empty) { decTotalAmount = Convert.ToDecimal(drow["Amount"].ToString()); drow["AmountInWords"] = new NumToText().AmountWords(decTotalAmount, PublicVariables._decCurrencyId); } crptPdcReceivable.Database.Tables["dtblOtherDetails"].SetDataSource(dtbl); } } } this.crptViewer.ReportSource = crptPdcReceivable; SettingsSP spSettings = new SettingsSP(); if (spSettings.SettingsStatusCheck("DirectPrint") == "No") { base.Show(); this.BringToFront(); } else { crptPdcReceivable.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex) { MessageBox.Show("CRV" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to print PurchaseReturn in curresponding Crystal report /// </summary> /// <param name="dsPurchaseReturnReport"></param> internal void PurchaseReturnPrinting(DataSet dsPurchaseReturnReport) { try { crptPurchaseReturn crptPurchaseReturnObj = new crptPurchaseReturn(); decimal decGrandAmount = 0; foreach (DataTable dtbl in dsPurchaseReturnReport.Tables) { if (dtbl.TableName == "Table") { crptPurchaseReturnObj.Database.Tables["dtblCompany"].SetDataSource(dtbl); } else if (dtbl.TableName == "Table1") { foreach (DataRow drow in dtbl.Rows) { DataColumn dtClmn = new DataColumn("amountInWords"); dtbl.Columns.Add(dtClmn); if (drow["grandTotal"].ToString() != string.Empty) { decGrandAmount = Convert.ToDecimal(drow["grandTotal"].ToString()); drow["amountInWords"] = new NumToText().AmountWords(decGrandAmount, PublicVariables._decCurrencyId); } crptPurchaseReturnObj.Database.Tables["dtblPurchaseReturnMaster"].SetDataSource(dtbl); } } else { crptPurchaseReturnObj.Database.Tables["dtblPurchaseReturnDetails"].SetDataSource(dtbl); } } this.crptViewer.ReportSource = crptPurchaseReturnObj; SettingsSP spSettings = new SettingsSP(); if (spSettings.SettingsStatusCheck("DirectPrint") == "No") { base.Show(); this.BringToFront(); } else { crptPurchaseReturnObj.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex) { MessageBox.Show("CRV11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to print PhysicalStock in curresponding Crystal report /// </summary> /// <param name="dsPhysicalStock"></param> internal void PhysicalStockPrinting(DataSet dsPhysicalStock) { try { crptPhysicalStock crptPhysicalStock = new crptPhysicalStock(); decimal decTotalAmount = 0; foreach (DataTable dtbl in dsPhysicalStock.Tables) { if (dtbl.TableName == "Table") { crptPhysicalStock.Database.Tables["dtblCompanyDetails"].SetDataSource(dtbl); } else if (dtbl.TableName == "Table1") { foreach (DataRow drow in dtbl.Rows) { DataColumn dtClmn = new DataColumn("AmountInWords"); dtbl.Columns.Add(dtClmn); if (drow["totalAmount"].ToString() != string.Empty) { decTotalAmount = Convert.ToDecimal(drow["totalAmount"].ToString()); drow["AmountInWords"] = new NumToText().AmountWords(decTotalAmount, PublicVariables._decCurrencyId); } crptPhysicalStock.Database.Tables["dtblOtherDetails"].SetDataSource(dtbl); } } else if (dtbl.TableName == "Table2") { DataColumn dtClmnSlNo = new DataColumn("SlNo"); dtbl.Columns.Add(dtClmnSlNo); int inRowIndex = 0; foreach (DataRow drSlNo in dtbl.Rows) { drSlNo["SlNo"] = ++inRowIndex; } crptPhysicalStock.Database.Tables["dtblGridDetails"].SetDataSource(dtbl); } } this.crptViewer.ReportSource = crptPhysicalStock; SettingsSP spSettings = new SettingsSP(); if (spSettings.SettingsStatusCheck("DirectPrint") == "No") { base.Show(); this.BringToFront(); } else { crptPhysicalStock.PrintToPrinter(1, false, 0, 0); } } catch (Exception) { throw; } }
/// <summary> /// Function to print PaySlip in curresponding Crystal report /// </summary> /// <param name="dsPaySlip"></param> internal void PaySlipPrinting(DataSet dsPaySlip) { try { decimal decTotalAdd = 0; decimal decTotalDed = 0; decimal decNetPay = 0; crptPaySlip crptPaySlip = new crptPaySlip(); foreach (DataTable dtbl in dsPaySlip.Tables) { if (dtbl.TableName == "Table") { crptPaySlip.Database.Tables["dtblCompanyDetails"].SetDataSource(dtbl); } else if (dtbl.TableName == "Table1") { crptPaySlip.Database.Tables["dtblEmployeeDetails"].SetDataSource(dtbl); foreach (DataRow drow in dtbl.Rows) { if (drow["ADDamount"].ToString() != string.Empty) { decTotalAdd += Convert.ToDecimal(drow["ADDamount"].ToString()); } if (drow["DEDamount"].ToString() != string.Empty) { decTotalDed += Convert.ToDecimal(drow["DEDamount"].ToString()); } } foreach (DataRow drow in dtbl.Rows) { if (drow["LOP"].ToString() != string.Empty) { decTotalDed += Convert.ToDecimal(drow["LOP"].ToString()); } if (drow["Deduction"].ToString() != string.Empty) { decTotalDed += Convert.ToDecimal(drow["Deduction"].ToString()); } if (drow["Advance"].ToString() != string.Empty) { decTotalDed += Convert.ToDecimal(drow["Advance"].ToString()); } if (drow["Bonus"].ToString() != string.Empty) { decTotalAdd += Convert.ToDecimal(drow["Bonus"].ToString()); } break; } } else if (dtbl.TableName == "Table2") { DataColumn dtClmn = new DataColumn("AmountInWords"); dtbl.Columns.Add(dtClmn); decNetPay = decTotalAdd - decTotalDed; foreach (DataRow drow in dtbl.Rows) { drow["AmountInWords"] = new NumToText().AmountWords(decNetPay, PublicVariables._decCurrencyId); } crptPaySlip.Database.Tables["dtblOther"].SetDataSource(dtbl); } } this.crptViewer.ReportSource = crptPaySlip; SettingsSP spSettings = new SettingsSP(); if (spSettings.SettingsStatusCheck("DirectPrint") == "No") { base.Show(); this.BringToFront(); } else { crptPaySlip.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex) { MessageBox.Show("CRV2 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Print function for dotmatrix printer /// </summary> /// <param name="decMasterId"></param> public void PrintForDotMatrix(decimal decMasterId) { try { DataTable dtblOtherDetails = new DataTable(); CompanySP spComapany = new CompanySP(); dtblOtherDetails = spComapany.CompanyViewForDotMatrix(); DataTable dtblGridDetails = new DataTable(); dtblGridDetails.Columns.Add("SlNo"); dtblGridDetails.Columns.Add("BarCode"); dtblGridDetails.Columns.Add("ProductCode"); dtblGridDetails.Columns.Add("ProductName"); dtblGridDetails.Columns.Add("Qty"); dtblGridDetails.Columns.Add("Unit"); dtblGridDetails.Columns.Add("Rate"); dtblGridDetails.Columns.Add("Amount"); int inRowCount = 0; foreach (DataGridViewRow dRow in dgvPurchaseOrder.Rows) { if (!dRow.IsNewRow) { DataRow dr = dtblGridDetails.NewRow(); dr["SlNo"] = ++inRowCount; if (dRow.Cells["dgvtxtBarcode"].Value != null) { dr["BarCode"] = Convert.ToString(dRow.Cells["dgvtxtBarcode"].Value); } if (dRow.Cells["dgvtxtProductCode"].Value != null) { dr["ProductCode"] = Convert.ToString(dRow.Cells["dgvtxtProductCode"].Value); } if (dRow.Cells["dgvtxtProductName"].Value != null) { dr["ProductName"] = Convert.ToString(dRow.Cells["dgvtxtProductName"].Value); } if (dRow.Cells["dgvtxtQty"].Value != null) { dr["Qty"] = Convert.ToString(dRow.Cells["dgvtxtQty"].Value); } if (dRow.Cells["dgvcmbUnit"].Value != null) { dr["Unit"] = Convert.ToString(dRow.Cells["dgvcmbUnit"].FormattedValue); } if (dRow.Cells["dgvtxtRate"].Value != null) { dr["Rate"] = Convert.ToString(dRow.Cells["dgvtxtRate"].Value); } if (dRow.Cells["dgvtxtAmount"].Value != null) { dr["Amount"] = Convert.ToString(dRow.Cells["dgvtxtAmount"].Value); } dtblGridDetails.Rows.Add(dr); } } dtblOtherDetails.Columns.Add("voucherNo"); dtblOtherDetails.Columns.Add("date"); dtblOtherDetails.Columns.Add("ledgerName"); dtblOtherDetails.Columns.Add("Narration"); dtblOtherDetails.Columns.Add("Currency"); dtblOtherDetails.Columns.Add("TotalAmount"); dtblOtherDetails.Columns.Add("DueDays"); dtblOtherDetails.Columns.Add("DueDate"); dtblOtherDetails.Columns.Add("CustomerAddress"); dtblOtherDetails.Columns.Add("CustomerTIN"); dtblOtherDetails.Columns.Add("CustomerCST"); dtblOtherDetails.Columns.Add("AmountInWords"); dtblOtherDetails.Columns.Add("Declaration"); dtblOtherDetails.Columns.Add("Heading1"); dtblOtherDetails.Columns.Add("Heading2"); dtblOtherDetails.Columns.Add("Heading3"); dtblOtherDetails.Columns.Add("Heading4"); DataRow dRowOther = dtblOtherDetails.Rows[0]; dRowOther["voucherNo"] = txtOrderNo.Text; dRowOther["date"] = txtDate.Text; dRowOther["ledgerName"] = cmbCashOrParty.Text; dRowOther["Narration"] = txtNarration.Text; dRowOther["Currency"] = cmbCurrency.Text; dRowOther["TotalAmount"] = txtTotalAmount.Text; dRowOther["DueDays"] = txtDueDays.Text; dRowOther["DueDate"] = txtDueDate.Text; dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", ""); AccountLedgerSP spAccountLedger = new AccountLedgerSP(); AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo(); infoAccountLedger = spAccountLedger.AccountLedgerView(Convert.ToDecimal(cmbCashOrParty.SelectedValue)); dRowOther["CustomerAddress"] = (infoAccountLedger.Address.ToString().Replace("\n", ", ")).Replace("\r", ""); dRowOther["CustomerTIN"] = infoAccountLedger.Tin; dRowOther["CustomerCST"] = infoAccountLedger.Cst; dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtTotalAmount.Text), PublicVariables._decCurrencyId); VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblDeclaration = spVoucherType.DeclarationAndHeadingGetByVoucherTypeId(decPurchaseOrderTypeId); dRowOther["Declaration"] = Convert.ToString(dtblDeclaration.Rows[0]["Declaration"]); dRowOther["Heading1"] = Convert.ToString(dtblDeclaration.Rows[0]["Heading1"]); dRowOther["Heading2"] = Convert.ToString(dtblDeclaration.Rows[0]["Heading2"]); dRowOther["Heading3"] = Convert.ToString(dtblDeclaration.Rows[0]["Heading3"]); dRowOther["Heading4"] = Convert.ToString(dtblDeclaration.Rows[0]["Heading4"]); int inFormId = spVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString())); PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails); } catch (Exception ex) { MessageBox.Show("PO15:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }