/// <summary> /// Function to check the voucher type and fill the corresponding vouchertype in VoucherType combobox /// </summary> /// <param name="strVoucherType"></param> public void CallFromVoucherMenu(string strVoucherType) { try { if (formMDI.strVouchertype == "POS") { VoucherType = "POS"; } else VoucherType = strVoucherType; VoucherTypeBll BllVoucherType = new VoucherTypeBll(); List<DataTable> listObjVouchetType = new List<DataTable>(); listObjVouchetType = BllVoucherType.VoucherTypeSelectionComboFill(strVoucherType); int inCount = listObjVouchetType[0].Rows.Count; cmbVoucherType.DataSource = listObjVouchetType[0]; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.DisplayMember = "voucherTypeName"; cmbVoucherType.SelectedIndex = -1; if (inCount == 1) { cmbVoucherType.SelectedValue = listObjVouchetType[0].Rows[0].ItemArray[0].ToString(); btnGo_Click(btnGo, EventArgs.Empty); } else { base.Show(); } } catch (Exception ex) { MessageBox.Show("VTS1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill AgainstVoucherType combobox /// </summary> /// <param name="strVoucherType"></param> public void AgainstVoucherTypeComboFill(string strVoucherType) { VoucherTypeBll BllVoucherType = new VoucherTypeBll(); List<DataTable> listObj = new List<DataTable>(); try { listObj = BllVoucherType.VoucherTypeSelectionComboFill(strVoucherType); DataRow drow = listObj[0].NewRow(); drow["voucherTypeId"] = 0; drow["voucherTypeName"] = "All"; listObj[0].Rows.InsertAt(drow, 0); cmbAgainstVoucherType.DataSource = listObj[0]; cmbAgainstVoucherType.ValueMember = "voucherTypeId"; cmbAgainstVoucherType.DisplayMember = "voucherTypeName"; } catch (Exception ex) { MessageBox.Show("PIREP4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// when cell double click for update function /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvVoucherType_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex != -1) { isEditMode = true; btnSave.Text = "Update"; txtVoucherNameSearch.Focus(); btnDelete.Enabled = true; int inRowCount = dgvApplicableTaxes.RowCount; for (int i = 0; i < inRowCount; i++) { dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value = false; } VoucherTypeBll BllVoucherType = new VoucherTypeBll(); VoucherTypeInfo infoVoucherType = new VoucherTypeInfo(); decVoucherTypeId = Convert.ToDecimal(dgvVoucherType.CurrentRow.Cells["dgvtxtvoucherTypeId"].Value.ToString()); infoVoucherType = BllVoucherType.VoucherTypeView(decVoucherTypeId); txtVoucherName.Text = infoVoucherType.VoucherTypeName; cmbTypeOfVoucher.Text = infoVoucherType.TypeOfVoucher; cmbMethodOfvoucherNumbering.Text = infoVoucherType.MethodOfVoucherNumbering; txtNarration.Text = infoVoucherType.Narration; txtDeclaration.Text = infoVoucherType.Declarartion; cmbDotMatrix.SelectedValue = infoVoucherType.MasterId; txtHeading1.Text = infoVoucherType.Heading1; txtHeading2.Text = infoVoucherType.Heading2; txtHeading3.Text = infoVoucherType.Heading3; txtHeading4.Text = infoVoucherType.Heading4; if (infoVoucherType.IsActive) { cbxActive.Checked = true; } else { cbxActive.Checked = false; } List<DataTable> listObj = new List<DataTable>(); listObj = BllVoucherType.GetTaxIdForTaxSelection(decVoucherTypeId); foreach (DataRow dr in listObj[0].Rows) { string strTaxId = dr["taxId"].ToString(); for (int i = 0; i < inRowCount; i++) { if (dgvApplicableTaxes.Rows[i].Cells["dgvtxtTaxId"].Value.ToString() == strTaxId) { dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value = true; } } } if (BllVoucherType.CheckForDefaultVoucherType(decVoucherTypeId) == false) { txtVoucherName.Enabled = true; cmbTypeOfVoucher.Enabled = true; } else { txtVoucherName.Enabled = false; cmbTypeOfVoucher.Enabled = false; } if (cmbTypeOfVoucher.Text == "Sales Return" || cmbTypeOfVoucher.Text == "Sales Invoice" || cmbTypeOfVoucher.Text == "Purchase Return" || cmbTypeOfVoucher.Text == "Purchase Invoice") { dgvApplicableTaxes.Enabled = true; } else { dgvApplicableTaxes.Enabled = false; } } } catch (Exception ex) { MessageBox.Show("VT17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
// Invoked from frmVoucherTypeSelection form /// <summary> /// Function to call this form from VoucherType Selection form /// </summary> /// <param name="decServiceVoucherTypeId"></param> /// <param name="strServiceVoucherTypeName"></param> public void CallFromVoucherTypeSelection(decimal decServiceVoucherTypeId, string strServiceVoucherTypeName) { try { DecServicetVoucherTypeId = decServiceVoucherTypeId; VoucherTypeBll BllVoucherType = new VoucherTypeBll(); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(DecServicetVoucherTypeId); // Checking voucher number is automatic or not SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(DecServicetVoucherTypeId, dtpVoucherDate.Value); decServiceSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; this.Text = strServiceVoucherTypeName; base.Show(); } catch (Exception ex) { MessageBox.Show("SV 13 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call These form from vouchertype Selection form /// </summary> /// <param name="decVoucherTypeId"></param> /// <param name="strVoucherTypeName"></param> public void CallFromVoucherTypeSelection(decimal decVoucherTypeId, string strVoucherTypeName) { try { VoucherTypeBll BllVoucherType = new VoucherTypeBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); decDeliveryNoteVoucherTypeId = decVoucherTypeId; isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decDeliveryNoteVoucherTypeId); infoSuffixPrefix = new SuffixPrefixSettingsBll().GetSuffixPrefixDetails(decDeliveryNoteVoucherTypeId, dtpDate.Value); decDeliveryNoteSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; this.Text = strVoucherTypeName; base.Show(); if (isAutomatic) { txtDate.Focus(); } else { txtDeliveryNoteNo.Focus(); } } catch (Exception ex) { MessageBox.Show("DN07:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// To fill the details according to the DeliveryNote master Id from frmDeliveryNoteRegister and frmDeliveryNoteReport /// </summary> public void FillRegisterOrReport() { try { DeliveryNoteMasterInfo infoDeliveryNoteMaster = new DeliveryNoteMasterInfo(); VoucherTypeInfo infoVoucherType = new VoucherTypeInfo(); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); //DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP(); //DeliveryNoteDetailsSP spDeliveryNoteDetails = new DeliveryNoteDetailsSP(); DeliveryNoteBll bllDeliveryNote = new DeliveryNoteBll(); SalesOrderMasterInfo infoSalesOrderMaster = new SalesOrderMasterInfo(); SalesOrderBll bllSalesOrder = new SalesOrderBll(); SalesQuotationMasterInfo infoSalesQuotationMaster = new SalesQuotationMasterInfo(); SalesQuotationBll bllSalesQuotatin = new SalesQuotationBll(); dgvProduct.Rows.Clear(); isRegisterReportFill = true; btnSave.Text = "Update"; int inRowIndex = 0; btnDelete.Enabled = true; txtDeliveryNoteNo.ReadOnly = true; if (txtDeliveryNoteNo.ReadOnly == true) { txtDate.Focus(); } else { txtDeliveryNoteNo.Focus(); } infoDeliveryNoteMaster = bllDeliveryNote.DeliveryNoteMasterViewAllByMasterId(decDelivryNoteIdToEdit); txtDeliveryNoteNo.Text = infoDeliveryNoteMaster.InvoiceNo; strVoucherNo = infoDeliveryNoteMaster.VoucherNo.ToString(); decDeliveryNoteSuffixPrefixId = Convert.ToDecimal(infoDeliveryNoteMaster.SuffixPrefixId); decDeliveryNoteVoucherTypeId = Convert.ToDecimal(infoDeliveryNoteMaster.VoucherTypeId); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decDeliveryNoteVoucherTypeId); decDeliveryNoteTypeId = decDeliveryNoteVoucherTypeId; cmbCashOrParty.SelectedValue = infoDeliveryNoteMaster.LedgerId; txtDate.Text = infoDeliveryNoteMaster.Date.ToString("dd-MMM-yyyy"); cmbPricingLevel.SelectedValue = infoDeliveryNoteMaster.PricinglevelId; infoVoucherType = BllVoucherType.VoucherTypeView(decDeliveryNoteVoucherTypeId); this.Text = infoVoucherType.VoucherTypeName; if (infoDeliveryNoteMaster.OrderMasterId != 0) { cmbDeliveryMode.Text = "Against Order"; infoSalesOrderMaster = bllSalesOrder.SalesOrderMasterView(infoDeliveryNoteMaster.OrderMasterId); cmbType.SelectedValue = infoSalesOrderMaster.VoucherTypeId; AgainstOrderComboFill(); cmbOrderNo.SelectedValue = infoDeliveryNoteMaster.OrderMasterId; } else if (infoDeliveryNoteMaster.QuotationMasterId != 0) { cmbDeliveryMode.Text = "Against Quotation"; infoSalesQuotationMaster = bllSalesQuotatin.SalesQuotationMasterView(infoDeliveryNoteMaster.QuotationMasterId); cmbType.SelectedValue = infoSalesQuotationMaster.VoucherTypeId; AgainstQuotationComboFill(); cmbOrderNo.SelectedValue = infoDeliveryNoteMaster.QuotationMasterId; } CurrencyComboFill(); cmbSalesMan.SelectedValue = infoDeliveryNoteMaster.EmployeeId; cmbCurrency.SelectedValue = infoDeliveryNoteMaster.ExchangeRateId; txtTraspotationCompany.Text = infoDeliveryNoteMaster.TransportationCompany; txtNarration.Text = infoDeliveryNoteMaster.Narration; txtLRNo.Text = infoDeliveryNoteMaster.LrNo; txtTotalAmnt.Text = infoDeliveryNoteMaster.TotalAmount.ToString("00.00"); List<DataTable> listObjDetails = bllDeliveryNote.DeliveryNoteDetailsViewByDeliveryNoteMasterId(decDelivryNoteIdToEdit); foreach (DataRow drowDetails in listObjDetails[0].Rows) { dgvProduct.Rows.Add(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].Value = drowDetails["barcode"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtDetailsId"].Value = drowDetails["deliveryNoteDetailsId"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtVoucherNo"].Value = drowDetails["VoucherNo"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtInvoiceNo"].Value = drowDetails["OrderNoOrQuotationNo"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtVoucherTypeId"].Value = drowDetails["VoucherTypeId"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductId"].Value = drowDetails["productId"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductCode"].Value = drowDetails["productCode"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"].Value = drowDetails["productName"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["Col"].Value = drowDetails["slNo"].ToString(); if (Convert.ToDecimal(drowDetails["orderDetails1Id"].ToString()) == 0) { dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtOrderDetailsId"].Value = 0; } else { dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtOrderDetailsId"].Value = Convert.ToDecimal(drowDetails["orderDetails1Id"].ToString()); } if (Convert.ToDecimal(drowDetails["quotationDetails1Id"].ToString()) != 0) { dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtOrderDetailsId"].Value = Convert.ToDecimal(drowDetails["quotationDetails1Id"].ToString()); } BatchComboFill(Convert.ToDecimal(drowDetails["productId"].ToString()), dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].ColumnIndex); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(drowDetails["batchId"].ToString()); UnitComboFill1(Convert.ToDecimal(drowDetails["productId"].ToString()), dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ColumnIndex); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(drowDetails["unitId"].ToString()); GridGodownComboFill(Convert.ToDecimal(drowDetails["productId"].ToString()), dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbGodown"].ColumnIndex); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(drowDetails["godownId"].ToString()); RackComboFill1(Convert.ToDecimal(drowDetails["godownId"].ToString()), dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbRack"].ColumnIndex); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbRack"].Value = Convert.ToDecimal(drowDetails["rackId"].ToString()); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtQty"].Value = drowDetails["qty"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtRate"].Value = drowDetails["rate"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtUnitConversionId"].Value = drowDetails["unitConversionId"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtConversionRate"].Value = drowDetails["conversionRate"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtAmount"].Value = drowDetails["amount"].ToString(); if (cmbOrderNo.Visible == true) { dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ReadOnly = true; } if (bllDeliveryNote.DeliveryNoteMasterReferenceCheckRejectionIn(decDelivryNoteIdToEdit)) { dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductCode"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbGodown"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbRack"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtRate"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ReadOnly = true; } dgvProduct.Rows[dgvProduct.Rows.Count - 2].HeaderCell.Value = ""; AmountCalculation("dgvtxtQty", inRowIndex); TotalAmountCalculation(); } if (!isAutomatic) { txtDeliveryNoteNo.ReadOnly = false; txtDeliveryNoteNo.Focus(); } isRegisterReportFill = false; isDoAfterGridFill = true; } catch (Exception ex) { MessageBox.Show("DN19: " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill TypeOfVoucher combobox /// </summary> public void TypeOfVoucherCombofill() { try { List<DataTable> listObj = new List<DataTable>(); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); listObj = BllVoucherType.TypeOfVoucherCombofillForVatAndTaxReport(); DataRow dr = listObj[0].NewRow(); dr["typeOfVoucher"] = "All"; dr["voucherTypeId"] = 0; listObj[0].Rows.InsertAt(dr, 0); cmbTypeOfVoucher.DataSource = listObj[0]; cmbTypeOfVoucher.DisplayMember = "typeOfVoucher"; cmbTypeOfVoucher.ValueMember = "voucherTypeId"; } catch (Exception ex) { MessageBox.Show("TR:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from VoucherType Selection form /// </summary> /// <param name="decVoucherTypeId"></param> /// <param name="strVoucherTypeName"></param> public void CallFromVoucherTypeSelection(decimal decVoucherTypeId, string strVoucherTypeName) { try { decPDCReceivableVoucherTypeId = decVoucherTypeId; VoucherTypeBll BllVoucherType = new VoucherTypeBll(); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decPDCReceivableVoucherTypeId); SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decPDCReceivableVoucherTypeId, dtpVoucherDate.Value); decSufixprefixPdcReceivableID = infoSuffixPrefix.SuffixprefixId; this.Text = strVoucherTypeName; base.Show(); if (isAutomatic) { txtVoucherDate.Focus(); } else { txtVoucherNo.Focus(); } ClearFunction(); } catch (Exception ex) { MessageBox.Show("PR15:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Fill function to updation /// </summary> /// <param name="isPending"></param> public void FillRegisterOrReport(bool isPending) { try { PurchaseOrderMasterInfo infoPurchaseOrderMaster = new PurchaseOrderMasterInfo(); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); PurchaseOrderBll BllPurchaseOrder = new PurchaseOrderBll(); btnSave.Text = "Update"; btnDelete.Enabled = true; txtOrderNo.ReadOnly = true; infoPurchaseOrderMaster = BllPurchaseOrder.PurchaseOrderMasterView(decPurchaseOrderMasterId); txtOrderNo.Text = infoPurchaseOrderMaster.InvoiceNo; strVoucherNo = infoPurchaseOrderMaster.VoucherNo.ToString(); decPurchaseSuffixPrefixId = Convert.ToDecimal(infoPurchaseOrderMaster.SuffixPrefixId); decPurchaseVoucherId = Convert.ToDecimal(infoPurchaseOrderMaster.VoucherTypeId); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decPurchaseVoucherId); decPurchaseOrderTypeId = decPurchaseVoucherId; txtDate.Text = infoPurchaseOrderMaster.Date.ToString("dd-MMM-yyyy"); cmbCashOrParty.SelectedValue = infoPurchaseOrderMaster.LedgerId; txtDueDate.Text = infoPurchaseOrderMaster.DueDate.ToString("dd-MMM-yyyy"); TimeSpan objTs = Convert.ToDateTime(txtDueDate.Text).Subtract(Convert.ToDateTime(txtDate.Text)); txtDueDays.Text = objTs.Days.ToString(); txtNarration.Text = infoPurchaseOrderMaster.Narration; cmbCurrency.SelectedValue = infoPurchaseOrderMaster.exchangeRateId; txtTotalAmount.Text = infoPurchaseOrderMaster.TotalAmount.ToString(); List<DataTable> ListObj = new List<DataTable>(); if (isPending) { ListObj = BllPurchaseOrder.PurchaseOrderDetailsViewWithRemaining(decPurchaseOrderMasterId); } else { ListObj = BllPurchaseOrder.PurchaseOrderDetailsViewByMasterId(decPurchaseOrderMasterId); } if (CheckCancelStatus(decPurchaseOrderMasterId)) { isCheck = true; cbxCancel.Checked = true; cbxCancel.Enabled = false; isCheck = false; } else { isCheck = true; cbxCancel.Enabled = true; // cbxCancel.Checked = false; isCheck = false; } dgvPurchaseOrder.Rows.Clear(); for (int i = 0; i < ListObj[0].Rows.Count; i++) { isAmountcalc = false; dgvPurchaseOrder.Rows.Add(); dgvPurchaseOrder.Rows[i].HeaderCell.Value = string.Empty; dgvPurchaseOrder.Rows[i].Cells["dgvtxtPurchaseOrderDetailsId"].Value = Convert.ToDecimal(ListObj[0].Rows[i]["purchaseOrderDetailsId"].ToString()); decPurchaseOrderDetailId = Convert.ToDecimal(ListObj[0].Rows[i]["purchaseOrderDetailsId"].ToString()); dgvPurchaseOrder.Rows[i].Cells["dgvtxtProductId"].Value = ListObj[0].Rows[i]["productId"].ToString(); dgvPurchaseOrder.Rows[i].Cells["dgvtxtProductCode"].Value = ListObj[0].Rows[i]["productCode"].ToString(); dgvPurchaseOrder.Rows[i].Cells["dgvtxtProductName"].Value = ListObj[0].Rows[i]["productName"].ToString(); dgvPurchaseOrder.Rows[i].Cells["dgvtxtQty"].Value = ListObj[0].Rows[i]["qty"].ToString(); UnitComboFill(Convert.ToDecimal(ListObj[0].Rows[i]["productId"].ToString()), i, dgvPurchaseOrder.Rows[i].Cells["dgvcmbUnit"].ColumnIndex); dgvPurchaseOrder.Rows[i].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(ListObj[0].Rows[i]["unitId"].ToString()); dgvPurchaseOrder.Rows[i].Cells["dgvtxtUnitConversionId"].Value = ListObj[0].Rows[i]["unitConversionId"].ToString(); dgvPurchaseOrder.Rows[i].Cells["dgvtxtUnitConversionRate"].Value = ListObj[0].Rows[i]["conversionRate"].ToString(); dgvPurchaseOrder.Rows[i].Cells["dgvtxtRate"].Value = ListObj[0].Rows[i]["rate"].ToString(); dgvPurchaseOrder.Rows[i].Cells["dgvtxtAmount"].Value = ListObj[0].Rows[i]["amount"].ToString(); dgvPurchaseOrder.Rows[i].Cells["dgvtxtProductName"].ReadOnly = true; dgvPurchaseOrder.Rows[i].Cells["dgvtxtProductCode"].ReadOnly = true; dgvPurchaseOrder.Rows[i].Cells["dgvtxtBarcode"].ReadOnly = true; } SerialNo(); isAmountcalc = true; } catch (Exception ex) { MessageBox.Show("PO25:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the details here for updation /// </summary> public void DetailsFillForEdit() { try { VoucherTypeBll BllVoucherType = new VoucherTypeBll(); isFormIdtoEdit = true; btnSave.Text = "Update"; btnDelete.Enabled = true; txtVoucherNo.ReadOnly = true; txtPaidAmount.Text = "0"; txtBalance.Text = "0"; txtDate.Focus(); List<DataTable> listMaster = BllSalesInvoice.POSSalesMasterViewBySalesMasterId(decSalesMasterId); txtVoucherNo.Text = listMaster[0].Rows[0]["invoiceNo"].ToString(); strVoucherNo = listMaster[0].Rows[0]["voucherNo"].ToString(); decPOSSuffixPrefixId = Convert.ToDecimal(listMaster[0].Rows[0]["suffixPrefixId"].ToString()); DecPOSVoucherTypeId = Convert.ToDecimal(listMaster[0].Rows[0]["voucherTypeId"].ToString()); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(DecPOSVoucherTypeId); txtDate.Text = listMaster[0].Rows[0]["date"].ToString(); dtpDate.Value = Convert.ToDateTime(txtDate.Text); cmbCashOrParty.SelectedValue = listMaster[0].Rows[0]["ledgerId"].ToString(); txtNarration.Text = listMaster[0].Rows[0]["narration"].ToString(); txtTotalAmount.Text = listMaster[0].Rows[0]["totalAmount"].ToString(); txtBillDiscount.Text = listMaster[0].Rows[0]["billDiscount"].ToString(); txtGrandTotal.Text = listMaster[0].Rows[0]["grandTotal"].ToString(); cmbSalesAccount.SelectedValue = listMaster[0].Rows[0]["salesAccount"].ToString(); cmbCounter.SelectedValue = listMaster[0].Rows[0]["counterId"].ToString(); cmbPricingLevel.SelectedValue = listMaster[0].Rows[0]["pricingLevelId"].ToString(); cmbSalesMan.SelectedValue = listMaster[0].Rows[0]["employeeId"].ToString(); txtBalance.Text = listMaster[0].Rows[0]["grandTotal"].ToString(); List<DataTable> listObj = new List<DataTable>(); listObj = BllSalesInvoice.SalesDetailsViewBySalesMasterId(decSalesMasterId); for (int i = 0; i < listObj[0].Rows.Count; i++) { dgvPointOfSales.Rows.Add(); decSalesDetailsId = Convert.ToDecimal(listObj[0].Rows[i]["salesDetailsId"].ToString()); dgvPointOfSales.Rows[i].Cells["dgvtxtSalesDetailsId"].Value = decSalesDetailsId; dgvPointOfSales.Rows[i].Cells["dgvtxtSlNo"].Value = listObj[0].Rows[i]["slNo"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtProductCode"].Value = listObj[0].Rows[i]["productCode"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtProductName"].Value = listObj[0].Rows[i]["productName"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtQuantity"].Value = listObj[0].Rows[i]["qty"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtUnit"].Value = listObj[0].Rows[i]["unitName"].ToString(); decimal dcrate = Convert.ToDecimal(listObj[0].Rows[i]["rate"].ToString()); dgvPointOfSales.Rows[i].Cells["dgvtxtRate"].Value = Math.Round(dcrate, PublicVariables._inNoOfDecimalPlaces); dgvPointOfSales.Rows[i].Cells["dgvtxtGrossValue"].Value = listObj[0].Rows[i]["grossAmount"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtDiscount"].Value = listObj[0].Rows[i]["discount"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtNetAmount"].Value = listObj[0].Rows[i]["netAmount"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtTaxPercentage"].Value = listObj[0].Rows[i]["taxName"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtTaxAmount"].Value = listObj[0].Rows[i]["taxAmount"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtTotalAmount"].Value = listObj[0].Rows[i]["amount"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtBarcode"].Value = listObj[0].Rows[i]["barcode"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtunitconversionId"].Value = listObj[0].Rows[i]["unitConversionId"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtBatchId"].Value = listObj[0].Rows[i]["batchId"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtRackId"].Value = listObj[0].Rows[i]["rackId"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtGodownId"].Value = listObj[0].Rows[i]["godownId"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtBatchno"].Value = listObj[0].Rows[i]["batchNo"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtGodownName"].Value = listObj[0].Rows[i]["godownName"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtRackName"].Value = listObj[0].Rows[i]["rackName"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxttaxid"].Value = listObj[0].Rows[i]["taxId"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtProductId"].Value = listObj[0].Rows[i]["productId"].ToString(); dgvPointOfSales.Rows[i].Cells["dgvtxtUnitId"].Value = listObj[0].Rows[i]["unitId"].ToString(); } taxGridFill(); listObj = BllSalesInvoice.SalesInvoiceSalesBillTaxViewAllBySalesMasterId(decSalesMasterId); foreach (DataGridViewRow dgvrowTax in dgvPOSTax.Rows) { for (int i = 0; i < listObj[0].Rows.Count; i++) { if (dgvPOSTax.Rows[i].Cells["dgvtxttax"].Value != null && dgvPOSTax.Rows[i].Cells["dgvtxttax"].Value.ToString() != string.Empty) { dgvPOSTax.Rows[i].Cells["dgvtxttax"].Value = listObj[0].Rows[i]["taxId"].ToString(); dgvPOSTax.Rows[i].Cells["dgvtxtTaxAmt"].Value = listObj[0].Rows[i]["taxAmount"].ToString(); } } } TaxTotal(); } catch (Exception ex) { MessageBox.Show("POS:56" + 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(); 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("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", ""); 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(txtGrandTotal.Text), PublicVariables._decCurrencyId); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); DataTable dtblDeclaration = BllVoucherType.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 = BllVoucherType.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> /// Fill function from coming from register or report or other forms /// </summary> public void FillRegisterOrReport() { //SalesMasterSP spSalesMaster = new SalesMasterSP(); //SalesDetailsSP spSalesDetails = new SalesDetailsSP(); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); //SalesBillTaxSP spSalesBillTax = new SalesBillTaxSP(); SalesInvoiceBll BllSalesInvoice = new SalesInvoiceBll(); try { isFromEditMode = true; btnSave.Text = "Update"; btnDelete.Enabled = true; txtInvoiceNo.ReadOnly = true; List<DataTable> listMaster = BllSalesInvoice.SalesInvoiceSalesMasterViewBySalesMasterId(decSalesInvoiceIdToEdit); DecSalesInvoiceVoucherTypeId = Convert.ToDecimal(listMaster[0].Rows[0]["voucherTypeId"].ToString()); VoucherTypeInfo infoVoucherType = new VoucherTypeInfo(); infoVoucherType = BllVoucherType.VoucherTypeView(DecSalesInvoiceVoucherTypeId); this.Text = infoVoucherType.VoucherTypeName; txtDate.Text = listMaster[0].Rows[0]["date"].ToString(); dtpDate.Value = DateTime.Parse(txtDate.Text); CurrencyComboFill(); txtInvoiceNo.Text = listMaster[0].Rows[0]["invoiceNo"].ToString(); txtCreditPeriod.Text = listMaster[0].Rows[0]["creditPeriod"].ToString(); strVoucherNo = listMaster[0].Rows[0]["voucherNo"].ToString(); decSalseInvoiceSuffixPrefixId = Convert.ToDecimal(listMaster[0].Rows[0]["suffixPrefixId"].ToString()); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(DecSalesInvoiceVoucherTypeId); cmbCashOrParty.SelectedValue = listMaster[0].Rows[0]["ledgerId"].ToString(); cmbSalesAccount.SelectedValue = listMaster[0].Rows[0]["salesAccount"].ToString(); cmbSalesMan.SelectedValue = listMaster[0].Rows[0]["employeeId"].ToString(); txtCustomer.Text = listMaster[0].Rows[0]["customerName"].ToString(); txtTransportCompany.Text = listMaster[0].Rows[0]["transportationCompany"].ToString(); txtVehicleNo.Text = listMaster[0].Rows[0]["lrNo"].ToString(); txtNarration.Text = listMaster[0].Rows[0]["narration"].ToString(); cmbCurrency.SelectedValue = Convert.ToDecimal(listMaster[0].Rows[0]["exchangeRateId"].ToString()); txtTotalAmount.Text = listMaster[0].Rows[0]["totalAmount"].ToString(); lblTaxTotalAmount.Text = listMaster[0].Rows[0]["taxAmount"].ToString(); cmbPricingLevel.SelectedValue = Convert.ToDecimal(listMaster[0].Rows[0]["pricingLevelId"].ToString()); if (listMaster[0].Rows[0]["quotationMasterId"].ToString() != "0") { cmbSalesMode.Text = "Against Quotation"; againstOrderComboFill(); cmbSalesModeOrderNo.SelectedValue = listMaster[0].Rows[0]["quotationMasterId"].ToString(); lblSalesModeOrderNo.Text = "Quotation No"; cmbCurrency.Enabled = false; cmbPricingLevel.Enabled = false; } else if (listMaster[0].Rows[0]["orderMasterId"].ToString() != "0") { cmbSalesMode.Text = "Against SalesOrder"; againstOrderComboFill(); cmbSalesModeOrderNo.SelectedValue = listMaster[0].Rows[0]["orderMasterId"].ToString(); lblSalesModeOrderNo.Text = "Order No"; cmbCurrency.Enabled = false; cmbPricingLevel.Enabled = false; } else if (listMaster[0].Rows[0]["deliveryNoteMasterId"].ToString() != "0") { cmbSalesMode.Text = "Against Delivery Note"; againstOrderComboFill(); cmbSalesModeOrderNo.SelectedValue = listMaster[0].Rows[0]["deliveryNoteMasterId"].ToString(); lblSalesModeOrderNo.Text = "Delivery Note No"; cmbCurrency.Enabled = false; cmbPricingLevel.Enabled = false; } else { cmbSalesMode.SelectedText = "NA"; } if (txtInvoiceNo.Enabled) { txtDate.Focus(); } else { txtInvoiceNo.Focus(); } //DataTable dtblDetails = new DataTable(); List<DataTable> listObj = new List<DataTable>(); listObj = BllSalesInvoice.SalesInvoiceSalesDetailsViewBySalesMasterId(decSalesInvoiceIdToEdit); dgvSalesInvoiceTaxComboFill(); dgvSalesInvoice.Rows.Clear(); for (int i = 0; i < listObj[0].Rows.Count; i++) { dgvSalesInvoice.Rows.Add(); IsSetGridValueChange = false; dgvSalesInvoice.Rows[i].HeaderCell.Value = string.Empty; dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesDetailsId"].Value = Convert.ToDecimal(listObj[0].Rows[i]["salesDetailsId"].ToString()); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSlno"].Value = listObj[0].Rows[i]["slNo"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceBarcode"].Value = listObj[0].Rows[i]["barcode"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductCode"].Value = listObj[0].Rows[i]["productCode"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductName"].Value = listObj[0].Rows[i]["productName"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductId"].Value = listObj[0].Rows[i]["productId"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceBrand"].Value = listObj[0].Rows[i]["brandName"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceQty"].Value = listObj[0].Rows[i]["qty"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoicePurchaseRate"].Value = listObj[0].Rows[i]["purchaseRate"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceAmount"].Value = listObj[0].Rows[i]["amount"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceGrossValue"].Value = listObj[0].Rows[i]["grossAmount"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoicembUnitName"].Value = Convert.ToDecimal(listObj[0].Rows[i]["unitId"].ToString()); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceRate"].Value = listObj[0].Rows[i]["rate"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceGodown"].Value = Convert.ToDecimal(listObj[0].Rows[i]["godownId"].ToString()); RackComboFill(Convert.ToDecimal(dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceGodown"].Value.ToString()), i, dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceRack"].ColumnIndex); dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceRack"].Value = Convert.ToDecimal(listObj[0].Rows[i]["rackId"].ToString()); if (listObj[0].Rows[i]["batchId"] != null && listObj[0].Rows[i]["batchId"].ToString() != string.Empty) { dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceBatch"].Value = Convert.ToDecimal(listObj[0].Rows[i]["batchId"].ToString()); } else { dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceBatch"].Value = string.Empty; } dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceMrp"].Value = listObj[0].Rows[i]["mrp"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesRate"].Value = listObj[0].Rows[i]["salesRate"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceDiscountAmount"].Value = listObj[0].Rows[i]["discount"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceNetAmount"].Value = listObj[0].Rows[i]["netAmount"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceTaxName"].Value = Convert.ToDecimal(listObj[0].Rows[i]["taxId"].ToString()); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceTaxAmount"].Value = listObj[0].Rows[i]["taxAmount"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceUnitConversionId"].Value = listObj[0].Rows[i]["unitConversionId"].ToString(); lblTotalQuantitydisplay.Text = listObj[0].Rows[i]["qty"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSISalesOrderDetailsId"].Value = Convert.ToDecimal(listObj[0].Rows[i]["orderDetailsId"].ToString()); // here get fill the grid colum for the editing prps dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceDeliveryNoteDetailsId"].Value = listObj[0].Rows[i]["deliveryNoteDetailsId"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceQuotationDetailsId"].Value = listObj[0].Rows[i]["quotationDetailsId"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceVoucherTypeId"].Value = Convert.ToDecimal(listObj[0].Rows[i]["voucherTypeRefNo"].ToString()); // here get fill the grid colum for the editing prps dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceVoucherNo"].Value = listObj[0].Rows[i]["voucherRefNo"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceInvoiceNo"].Value = listObj[0].Rows[i]["invoiceRefNo"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceBarcode"].ReadOnly = true; dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductCode"].ReadOnly = true; dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductName"].ReadOnly = true; dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceBrand"].ReadOnly = true; dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceBatch"].ReadOnly = true; if (cmbSalesMode.SelectedIndex != 0) { strVoucherNoTostockPost = dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceVoucherNo"].Value.ToString(); strInvoiceNoTostockPost = dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceInvoiceNo"].Value.ToString(); decVouchertypeIdTostockPost = Convert.ToDecimal(dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceVoucherTypeId"].Value); } GrossValueCalculation(i); DiscountCalculation(i, dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceDiscountAmount"].ColumnIndex); taxAndGridTotalAmountCalculation(i); decCurrentRate = Convert.ToDecimal(dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceRate"].Value.ToString()); decCurrentConversionRate = Convert.ToDecimal(listObj[0].Rows[i]["conversionRate"].ToString()); UnitConversionCalc(i); if (cmbSalesModeOrderNo.Visible == true) { dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoicembUnitName"].ReadOnly = true; } } List<DataTable> listAdditionalCost = new List<DataTable>(); listAdditionalCost = BllSalesInvoice.SalesInvoiceAdditionalCostViewByVoucherNoUnderVoucherType(DecSalesInvoiceVoucherTypeId, strVoucherNo); for (int i = 0; i < listAdditionalCost[0].Rows.Count; i++) { dgvSalesInvoiceLedger.Rows.Add(); dgvSalesInvoiceLedger.Rows[i].Cells["dgvtxtAdditionalCostId"].Value = listAdditionalCost[0].Rows[i]["additionalCostId"].ToString(); dgvSalesInvoiceLedger.Rows[i].Cells["dgvCmbAdditionalCostledgerName"].Value = Convert.ToDecimal(listAdditionalCost[0].Rows[i]["ledgerId"].ToString()); dgvSalesInvoiceLedger.Rows[i].Cells["dgvtxtAdditionalCoastledgerAmount"].Value = listAdditionalCost[0].Rows[i]["amount"].ToString(); List<DataTable> ListObj = new List<DataTable>(); AccountLedgerBll bllAccountLedger = new AccountLedgerBll(); ListObj = bllAccountLedger.AccountLedgerViewForAdditionalCost(); DataGridViewComboBoxCell dgvccVoucherType = (DataGridViewComboBoxCell)dgvSalesInvoiceLedger[dgvSalesInvoiceLedger.Columns["dgvCmbAdditionalCostledgerName"].Index, i]; dgvccVoucherType.DataSource = ListObj[0]; dgvccVoucherType.ValueMember = "ledgerId"; dgvccVoucherType.DisplayMember = "ledgerName"; } List<DataTable> ListDrOrCr = BllSalesInvoice.salesinvoiceAdditionalCostCheckdrOrCrforSiEdit(DecSalesInvoiceVoucherTypeId, strVoucherNo); if (ListDrOrCr[0].Rows.Count > 0) { if (Convert.ToDecimal(ListDrOrCr[0].Rows[0]["credit"].ToString()) != 0) { cmbCashOrbank.SelectedValue = Convert.ToDecimal(ListDrOrCr[0].Rows[0]["ledgerId"].ToString()); cmbCashOrbank.Visible = true; lblcashOrBank.Visible = true; cmbDrorCr.SelectedIndex = 0; decBankOrCashIdForEdit = Convert.ToDecimal(cmbCashOrbank.SelectedValue.ToString()); } else { cmbDrorCr.SelectedIndex = 1; } } taxGridFill(); List<DataTable> listTax = new List<DataTable>(); listTax = BllSalesInvoice.SalesInvoiceSalesBillTaxViewAllBySalesMasterId(decSalesInvoiceIdToEdit); foreach (DataGridViewRow dgvrowTax in dgvSalesInvoiceTax.Rows) { for (int ini = 0; ini < listTax[0].Rows.Count; ini++) { if (dgvrowTax.Cells["dgvtxtTtaxId"].Value != null && dgvrowTax.Cells["dgvtxtTtaxId"].Value.ToString() != string.Empty) { decimal decId = Convert.ToDecimal(listTax[0].Rows[ini]["taxId"].ToString()); if (dgvrowTax.Cells["dgvtxtTtaxId"].Value.ToString() == decId.ToString()) { dgvrowTax.Cells["dgvtxtTtaxAmount"].Value = listTax[0].Rows[ini]["taxAmount"].ToString(); break; } else { dgvrowTax.Cells["dgvtxtTtaxAmount"].Value = "0.00"; } } } } LedgerGridTotalAmountCalculation(); SiGridTotalAmountCalculation(); txtGrandTotal.Text = listMaster[0].Rows[0]["grandTotal"].ToString(); txtBillDiscount.Text = listMaster[0].Rows[0]["billDiscount"].ToString(); bool isPartyBalanceRef = false; AccountLedgerBll bllAccountLedger1 = new AccountLedgerBll(); PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); isPartyBalanceRef = bllAccountLedger1.PartyBalanceAgainstReferenceCheck(strVoucherNo, DecSalesInvoiceVoucherTypeId); if (isPartyBalanceRef) { cmbCashOrParty.Enabled = false; } else { cmbCashOrParty.Enabled = true; } } catch (Exception ex) { MessageBox.Show("SI: 77" + 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> /// Fill function for updation /// </summary> public void FillFunction() { try { PhysicalStockMasterInfo infoPhysicalStockMaster = new PhysicalStockMasterInfo(); //PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP(); PhysicalStockBll BllPhysicalStock = new PhysicalStockBll(); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); infoPhysicalStockMaster = BllPhysicalStock.PhysicalStockMasterView(decMasterId); txtVoucherNo.Text = infoPhysicalStockMaster.InvoiceNo; strVoucherNo = infoPhysicalStockMaster.VoucherNo.ToString(); decPhysicalStockSuffixPrefixId = Convert.ToDecimal(infoPhysicalStockMaster.SuffixPrefixId); decPhysicalStockVoucherTypeId = Convert.ToDecimal(infoPhysicalStockMaster.VoucherTypeId); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decPhysicalStockVoucherTypeId); txtDate.Text = infoPhysicalStockMaster.Date.ToString("dd-MMM-yyyy"); txtNarration.Text = infoPhysicalStockMaster.Narration; txtTotalAmount.Text = infoPhysicalStockMaster.TotalAmount.ToString(); List<DataTable> ListObj = new List<DataTable>(); ListObj = BllPhysicalStock.PhysicalStockViewbyMasterId(decMasterId); isFromEditMode = true; for (int i = 0; i < ListObj[0].Rows.Count; i++) { dgvPhysicalStock.Rows.Add(); dgvPhysicalStock.Rows[i].HeaderCell.Value = string.Empty; dgvPhysicalStock.Rows[i].Cells["dgvtxtPhysicalStockDetailId"].Value = Convert.ToDecimal(ListObj[0].Rows[i]["physicalStockDetailsId"].ToString()); dgvPhysicalStock.Rows[i].Cells["dgvtxtSlNo"].Value = ListObj[0].Rows[i]["slno"].ToString(); dgvPhysicalStock.Rows[i].Cells["dgvtxtProductCode"].Value = ListObj[0].Rows[i]["productCode"].ToString(); dgvPhysicalStock.Rows[i].Cells["dgvtxtProductName"].Value = ListObj[0].Rows[i]["productName"].ToString(); dgvPhysicalStock.Rows[i].Cells["dgvtxtQty"].Value = ListObj[0].Rows[i]["qty"].ToString(); BatchComboFill(Convert.ToDecimal(ListObj[0].Rows[i]["productId"].ToString()), i, dgvPhysicalStock.Rows[i].Cells["dgvcmbBatch"].ColumnIndex); dgvPhysicalStock.Rows[i].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(ListObj[0].Rows[i]["batchId"].ToString()); dgvPhysicalStock.Rows[i].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(ListObj[0].Rows[i]["unitId"].ToString()); dgvPhysicalStock.Rows[i].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(ListObj[0].Rows[i]["godownId"].ToString()); dgvPhysicalStock.Rows[i].Cells["dgvcmbRack"].Value = Convert.ToDecimal(ListObj[0].Rows[i]["rackId"].ToString()); dgvPhysicalStock.Rows[i].Cells["dgvtxtRate"].Value = ListObj[0].Rows[i]["rate"].ToString(); dgvPhysicalStock.Rows[i].Cells["dgvtxtAmount"].Value = ListObj[0].Rows[i]["amount"].ToString(); dgvPhysicalStock.Rows[i].Cells["dgvtxtBarcode"].Value = ListObj[0].Rows[i]["barcode"].ToString(); if (dgvPhysicalStock.Columns.Count > 0) { dgvPhysicalStock.Columns["dgvtxtRate"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dgvPhysicalStock.Columns["dgvtxtAmount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; } } isFromEditMode = false; } catch (Exception ex) { MessageBox.Show("PS:8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from VoucherType Selection form /// </summary> /// <param name="DecPhysicalStockVoucherType"></param> /// <param name="strPhysicalStockVouchertypeName"></param> public void CallFromVoucherTypeSelection(decimal DecPhysicalStockVoucherType, string strPhysicalStockVouchertypeName) { try { decPhysicalStockVoucherTypeId = DecPhysicalStockVoucherType; VoucherTypeBll BllVoucherType = new VoucherTypeBll(); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decPhysicalStockVoucherTypeId); SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decPhysicalStockVoucherTypeId, dtpDate.Value); decDailySuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; this.Text = strPhysicalStockVouchertypeName; base.Show(); } catch (Exception ex) { MessageBox.Show("PS:9" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Fill all the controlls while coming from other forms for update or delete /// </summary> public void FillFunction() { try { ContraVoucherDetailsBll bllContraVoucherDetails = new ContraVoucherDetailsBll(); ContraMasterInfo infoContraMaster = new ContraMasterInfo(); LedgerPostingBll BllLedgerPosting = new LedgerPostingBll(); VoucherTypeBll BllVOucherType = new VoucherTypeBll(); infoContraMaster = bllContraVoucherDetails.ContraMasterView(decMasterId); txtVoucherNo.ReadOnly = false; strVoucherNo = infoContraMaster.VoucherNo; txtVoucherNo.Text = infoContraMaster.InvoiceNo; strInvoiceNo = infoContraMaster.InvoiceNo; strInvoiceNo = infoContraMaster.InvoiceNo; decContraSuffixPrefixId = Convert.ToDecimal(infoContraMaster.SuffixPrefixId.ToString()); DecContraVoucherTypeId = Convert.ToDecimal(infoContraMaster.VoucherTypeId.ToString()); int inDecimalPlace = PublicVariables._inNoOfDecimalPlaces; txtNarration.Text = infoContraMaster.Narration; txtContraVoucherDate.Text = Convert.ToString(infoContraMaster.date); cmbBankAccount.SelectedValue = infoContraMaster.LedgerId; strVoucherNo = infoContraMaster.VoucherNo; if (infoContraMaster.Type == "Deposit") { rbtnDeposit.Checked = true; } else { rbtnWithdrawal.Checked = true; } isAutomatic = BllVOucherType.CheckMethodOfVoucherNumbering(DecContraVoucherTypeId); if (isAutomatic) { txtVoucherNo.Enabled = false; } else { txtVoucherNo.Enabled = true; } List<DataTable> listObj = new List<DataTable>(); listObj = bllContraVoucherDetails.ContraDetailsViewWithMasterId(decMasterId); for (int i = 0; i < listObj[0].Rows.Count; i++) { dgvContraVoucher.Rows.Add(); dgvContraVoucher.Rows[i].Cells["dgvcmbBankorCashAccount"].Value = Convert.ToDecimal(listObj[0].Rows[i]["ledgerId"].ToString()); dgvContraVoucher.Rows[i].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(listObj[0].Rows[i]["exchangeRateId"].ToString()); dgvContraVoucher.Rows[i].Cells["dgvtxtAmount"].Value = Convert.ToDecimal(listObj[0].Rows[i]["amount"].ToString()); if (listObj[0].Rows[i]["chequeNo"].ToString() != string.Empty) { dgvContraVoucher.Rows[i].Cells["dgvtxtChequeNo"].Value = listObj[0].Rows[i]["chequeNo"].ToString(); if (listObj[0].Rows[i]["chequeDate"].ToString() == "01 Jan 1753") { dgvContraVoucher.Rows[i].Cells["dgvtxtChequeDate"].Value = null; } else { dgvContraVoucher.Rows[i].Cells["dgvtxtChequeDate"].Value = listObj[0].Rows[i]["chequeDate"].ToString(); } } dgvContraVoucher.Rows[i].Cells["dgvtxtDetailsId"].Value = listObj[0].Rows[i]["contraDetailsId"].ToString(); decimal decDetailsId1 = Convert.ToDecimal(listObj[0].Rows[i]["contraDetailsId"].ToString()); decimal decLedgerPostingId = BllLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, DecContraVoucherTypeId); dgvContraVoucher.Rows[i].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString(); } } catch (Exception ex) { MessageBox.Show("CV:31" + 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> /// Function to fill VoucherType combobox /// </summary> public void VoucherTypeNameComboFill() { try { VoucherTypeBll BllVoucherType = new VoucherTypeBll(); List<DataTable> listObjVoucherTyeName = new List<DataTable>(); listObjVoucherTyeName = BllVoucherType.VoucherTypeNameComboFill(); DataRow dr = listObjVoucherTyeName[0].NewRow(); dr[1] = "All"; listObjVoucherTyeName[0].Rows.InsertAt(dr, 0); cmbVoucherTypeName.DataSource = listObjVoucherTyeName[0]; cmbVoucherTypeName.ValueMember = "voucherTypeId"; cmbVoucherTypeName.DisplayMember = "voucherTypeName"; } catch (Exception ex) { MessageBox.Show("MSR1:" + 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> /// Function to call this form from VoucherType Selection form /// </summary> /// <param name="decDailySalaryVoucherTypeId"></param> /// <param name="strVoucherTypeNames1"></param> public void CallFromVoucherTypeSelection(decimal decDailySalaryVoucherTypeId, string strVoucherTypeNames1) { try { decDailyVoucherTypeId = decDailySalaryVoucherTypeId; VoucherTypeBll BllVoucherType = new VoucherTypeBll(); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decDailyVoucherTypeId); SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); // SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decDailyVoucherTypeId, dtpDate.Value); decDailySuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; this.Text = strVoucherTypeNames1; base.Show(); if (isAutomatic) { txtDate.Focus(); } else { txtVoucherNo.Focus(); } } catch (Exception ex) { MessageBox.Show("DSV3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Fill function to updation /// </summary> public void FillFunction() { try { PDCRecivebleBll BllPdcRecieveble = new PDCRecivebleBll(); PDCReceivableMasterInfo infopdcrecivable = new PDCReceivableMasterInfo(); infopdcrecivable = BllPdcRecieveble.PDCReceivableMasterView(decPDCReceivableEditId); txtVoucherNo.ReadOnly = false; strVoucherNo = infopdcrecivable.VoucherNo; strInvoiceNo = infopdcrecivable.InvoiceNo; txtVoucherNo.Text = strInvoiceNo; decSufixprefixPdcReceivableID = infopdcrecivable.SuffixPrefixId; decPDCReceivableVoucherTypeId = infopdcrecivable.VoucherTypeId; VoucherTypeBll BllVoucherType = new VoucherTypeBll(); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decPDCReceivableVoucherTypeId); if (isAutomatic) { txtVoucherNo.ReadOnly = true; } else { txtVoucherNo.ReadOnly = false; lblVoucherNoManualValidator.Visible = false; } if (infopdcrecivable.PdcReceivableMasterId != 0) { txtVoucherNo.Text = infopdcrecivable.InvoiceNo; dtpVoucherDate.Value = infopdcrecivable.Date; txtVoucherDate.Text = dtpVoucherDate.Value.ToString("dd-MMM-yyyy"); txtNarration.Text = infopdcrecivable.Narration; cmbAccountLedger.SelectedValue = infopdcrecivable.LedgerId; txtAmount.Text = infopdcrecivable.Amount.ToString(); if (infopdcrecivable.BankId != 0) cmbBank.SelectedValue = infopdcrecivable.BankId; else cmbBank.SelectedValue = string.Empty; txtcheckNo.Text = infopdcrecivable.ChequeNo; txtCheckDate.Text = infopdcrecivable.ChequeDate.ToString("dd-MMM-yyyy"); btnSave.Text = "Update"; PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); List<DataTable> listObj = new List<DataTable>(); listObj = BllPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decPDCReceivableVoucherTypeId, strVoucherNo, infopdcrecivable.Date); dtblPartyBalance = listObj[0]; } } catch (Exception ex) { MessageBox.Show("PP24:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill controls for updation /// </summary> public void fillFunction() { try { DailySalaryVoucherBll BllDailySalaryVoucherMaster = new DailySalaryVoucherBll(); DailySalaryVoucherMasterInfo InfoMaster = new DailySalaryVoucherMasterInfo(); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); InfoMaster = BllDailySalaryVoucherMaster.DailySalaryVoucherViewFromRegister(decMasterIdforEdit); strVoucherNoforEdit = InfoMaster.VoucherNo; strVoucherNo = InfoMaster.VoucherNo; txtVoucherNo.Text = InfoMaster.InvoiceNo; strInvoiceNo = InfoMaster.InvoiceNo; dtpDate.Text = InfoMaster.Date.ToString(); dtpSalaryDate.Text = InfoMaster.SalaryDate.ToString(); lblShowTotelamount.Text = Math.Round(Convert.ToDecimal(InfoMaster.TotalAmount.ToString("0.00000")), PublicVariables._inNoOfDecimalPlaces).ToString(); txtNarration.Text = InfoMaster.Narration; decDailySuffixPrefixId = InfoMaster.SuffixPrefixId; decDailyVoucherTypeId = InfoMaster.VoucherTypeId; cmbCashorBankAccount.SelectedValue = InfoMaster.LedgerId.ToString(); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decDailyVoucherTypeId); if (isAutomatic) { txtVoucherNo.Enabled = false; } else { txtVoucherNo.Enabled = true; } dtpSalaryDate.Enabled = false; txtSalaryDate.Enabled = false; DailySalaryVoucherDetailsGridfill(isEditmode); } catch (Exception ex) { MessageBox.Show("DSV6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// To fill the vouchertype combobox /// </summary> public void VoucherTypeComboFill(string strVoucherName) { try { List<DataTable> listObj = new List<DataTable>(); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); listObj = BllVoucherType.VoucherTypeCombofillForTaxAndVat(strVoucherName); DataRow dr = listObj[0].NewRow(); dr["voucherTypeName"] = "All"; dr["voucherTypeId"] = 0; listObj[0].Rows.InsertAt(dr, 0); cmbVoucherType.DataSource = listObj[0]; cmbVoucherType.DisplayMember = "voucherTypeName"; cmbVoucherType.ValueMember = "voucherTypeId"; } catch (Exception ex) { MessageBox.Show("TR:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from frmVoucherSearch form to view voucher details /// </summary> /// <param name="frm"></param> /// <param name="decId"></param> public void CallFromVoucherSerach(frmVoucherSearch frm, decimal decId) { try { isEditMode = true; decIsEditModeMasterId = decId; base.Show(); SalaryVoucherBll BllSalaryVoucher = new SalaryVoucherBll(); SalaryVoucherMasterInfo InfoMaster = new SalaryVoucherMasterInfo(); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); btnDelete.Enabled = true; btnSave.Text = "Update"; InfoMaster = BllSalaryVoucher.SalaryVoucherMasterView(decIsEditModeMasterId); strVoucherNoforEdit = InfoMaster.VoucherNo; strVoucherNo = InfoMaster.VoucherNo; txtVoucherNo.Text = InfoMaster.InvoiceNo; strInvoiceNo = InfoMaster.InvoiceNo; txtVoucherDate.Text = InfoMaster.Date.ToString("dd-MMMM-yyyy"); string stra = Convert.ToDateTime(InfoMaster.Month.ToString()).ToString("MMM yyyy"); dtpMonth.Value = Convert.ToDateTime(InfoMaster.Month.ToString("MMM yyyy")); txtNarration.Text = InfoMaster.Narration; lblTotalAmount.Text = InfoMaster.TotalAmount.ToString(); decMonthlySuffixPrefixId = InfoMaster.SuffixPrefixId; decMonthlyVoucherTypeId = InfoMaster.VoucherTypeId; this.objVoucherSearch = frm; cmbCashOrBankAcc.SelectedValue = InfoMaster.LedgerId; isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decMonthlyVoucherTypeId); if (isAutomatic) { txtVoucherNo.Enabled = false; } else { txtVoucherNo.Enabled = true; } dtpMonth.Enabled = false; GridFill(isEditMode); } catch (Exception ex) { MessageBox.Show("MSV2: " + 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> /// Function to fill controls for updation /// </summary> public void FillFunction() { try { SalaryVoucherBll BllSalaryVoucher = new SalaryVoucherBll(); SalaryVoucherMasterInfo InfoMaster = new SalaryVoucherMasterInfo(); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); InfoMaster = BllSalaryVoucher.SalaryVoucherMasterView(decIsEditModeMasterId); strVoucherNoforEdit = InfoMaster.VoucherNo; strVoucherNo = InfoMaster.VoucherNo; txtVoucherNo.Text = InfoMaster.InvoiceNo; strInvoiceNo = InfoMaster.InvoiceNo; txtVoucherDate.Text = InfoMaster.Date.ToString("dd-MMMM-yyyy"); string stra = Convert.ToDateTime(InfoMaster.Month.ToString()).ToString("MMM yyyy"); dtpMonth.Value = Convert.ToDateTime(InfoMaster.Month.ToString("MMM yyyy")); txtNarration.Text = InfoMaster.Narration; decimal decTotalAmont = Math.Round(Convert.ToDecimal(InfoMaster.TotalAmount.ToString()), PublicVariables._inNoOfDecimalPlaces); lblTotalAmount.Text = decTotalAmont.ToString(); decMonthlySuffixPrefixId = InfoMaster.SuffixPrefixId; decMonthlyVoucherTypeId = InfoMaster.VoucherTypeId; cmbCashOrBankAcc.SelectedValue = InfoMaster.LedgerId; isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decMonthlyVoucherTypeId); if (isAutomatic) { txtVoucherNo.Enabled = false; } else { txtVoucherNo.Enabled = true; } dtpMonth.Enabled = false; GridFill(isEditMode); } catch (Exception ex) { MessageBox.Show("MSV10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
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> /// Function to fill VoucherType combobox /// </summary> public void VoucherTypeComboLoad() { try { VoucherTypeBll BllVoucherType = new VoucherTypeBll(); List<DataTable> listObjVouchetType = new List<DataTable>(); listObjVouchetType = BllVoucherType.VoucherTypeSelectionComboFill("Journal Voucher"); DataRow dr = listObjVouchetType[0].NewRow(); dr[0] = 0; dr[1] = "ALL"; listObjVouchetType[0].Rows.InsertAt(dr, 0); cmbVoucherType.DataSource = listObjVouchetType[0]; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.DisplayMember = "voucherTypeName"; cmbVoucherType.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show("JVREP2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the fields for edit or delete /// </summary> public void FillFunction() { try { ServicesBll BllService = new ServicesBll(); //ServiceMasterSP spServiceMaster = new ServiceMasterSP(); ServiceMasterInfo infoServiceMaster = new ServiceMasterInfo(); LedgerPostingBll BllLedgerPosting = new LedgerPostingBll(); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); VoucherTypeInfo infoVoucherType = new VoucherTypeInfo(); PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); PartyBalanceInfo infoPartyBalance = new PartyBalanceInfo(); decServiceMasterId = decMasterId; infoServiceMaster = BllService.ServiceMasterView(decServiceMasterId); infoVoucherType = BllVoucherType.VoucherTypeView(infoServiceMaster.VoucherTypeId); this.Text = infoVoucherType.VoucherTypeName; isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(infoServiceMaster.VoucherTypeId); txtInvoiceNumber.ReadOnly = true; strVoucherNo = infoServiceMaster.VoucherNo.ToString(); txtInvoiceNumber.Text = infoServiceMaster.InvoiceNo; txtCreditPeriod.Text = infoServiceMaster.CreditPeriod.ToString(); strInvoiceNo = infoServiceMaster.InvoiceNo.ToString(); decServiceSuffixPrefixId = Convert.ToDecimal(infoServiceMaster.SuffixPrefixId.ToString()); DecServicetVoucherTypeId = Convert.ToDecimal(infoServiceMaster.VoucherTypeId.ToString()); int inDecimalPlace = PublicVariables._inNoOfDecimalPlaces; txtVoucherDate.Text = infoServiceMaster.Date.ToString("dd-MMM-yyyy"); dtpVoucherDate.Value = Convert.ToDateTime(infoServiceMaster.Date); cmbCashParty.SelectedValue = infoServiceMaster.LedgerId; cmbServiceAC.SelectedValue = infoServiceMaster.ServiceAccount; cmbSalesman.SelectedValue = infoServiceMaster.EmployeeId; txtCustomer.Text = infoServiceMaster.Customer; txtNarration.Text = infoServiceMaster.Narration; List<DataTable> listObjServiceDetails = new List<DataTable>(); listObjServiceDetails = BllService.ServiceDetailsViewWithMasterId(decServiceMasterId); for (int i = 0; i < listObjServiceDetails[0].Rows.Count; i++) { dgvServiceVoucher.Rows.Add(); dgvServiceVoucher.Rows[i].Cells["dgvtxtDetailsId"].Value = Convert.ToDecimal(listObjServiceDetails[0].Rows[i]["serviceDetailsId"].ToString()); dgvServiceVoucher.Rows[i].Cells["dgvtxtServiceMasterId"].Value = Convert.ToDecimal(listObjServiceDetails[0].Rows[i]["serviceMasterId"].ToString()); dgvServiceVoucher.Rows[i].Cells["dgvcmbParticulars"].Value = Convert.ToDecimal(listObjServiceDetails[0].Rows[i]["serviceId"].ToString()); dgvServiceVoucher.Rows[i].Cells["dgvtxtMeasure"].Value = listObjServiceDetails[0].Rows[i]["measure"].ToString(); dgvServiceVoucher.Rows[i].Cells["dgvtxtAmount"].Value = listObjServiceDetails[0].Rows[i]["amount"].ToString(); decimal decDetailsId1 = Convert.ToDecimal(listObjServiceDetails[0].Rows[i]["serviceDetailsId"].ToString()); decimal decLedgerPostingId = BllLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, DecServicetVoucherTypeId); dgvServiceVoucher.Rows[i].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString(); } cmbCurrency.SelectedValue = infoServiceMaster.ExchangeRateId; txtTotalAmount.Text = infoServiceMaster.TotalAmount.ToString(); txtDiscount.Text = infoServiceMaster.Discount.ToString(); txtGrandTotal.Text = infoServiceMaster.GrandTotal.ToString(); infoPartyBalance = BllPartyBalance.PartyBalanceViewByVoucherNoAndVoucherTypeId(DecServicetVoucherTypeId, strVoucherNo, infoServiceMaster.Date); decPartyBalanceId = infoPartyBalance.PartyBalanceId; } catch (Exception ex) { MessageBox.Show("SV 32 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// its a function for vouchertype selection form to select purticular voucher and open the form under the vouchertype /// </summary> /// <param name="decDailyContraVoucherTypeId"></param> /// <param name="strVoucherTypeNames1"></param> public void CallFromVoucherTypeSelection(decimal decDailyContraVoucherTypeId, string strVoucherTypeNames1) { try { DecContraVoucherTypeId = decDailyContraVoucherTypeId; VoucherTypeBll BllVoucherType = new VoucherTypeBll(); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(DecContraVoucherTypeId); SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(DecContraVoucherTypeId, dtpContraVoucherDate.Value); decContraSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; this.Text = strVoucherTypeNames1; base.Show(); Clear(); } catch (Exception ex) { MessageBox.Show("CV:10" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }