public bool DayBookSalesInvoiceOrPOS(decimal decSalesMasterId, decimal decVoucherTypeId) { bool isResult = false; try { isResult = SPSalesMaster.DayBookSalesInvoiceOrPOS(decSalesMasterId, decVoucherTypeId); } catch (Exception ex) { MessageBox.Show("CB:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(isResult); }
/// <summary> /// When doubleclicking on the grid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvReport_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { decimal decVouchertypeId = 0; string strVoucherNo = string.Empty; try { if (dgvReport.CurrentRow.Index == e.RowIndex) { if ((dgvReport.CurrentRow.Cells["voucherTypeId"].Value != null && dgvReport.CurrentRow.Cells["voucherTypeId"].Value.ToString() != string.Empty)) { int inI = dgvReport.CurrentCell.RowIndex; foreach (DataGridViewRow dgv in dgvReport.Rows) { if (dgv.Cells["VoucherNo"].Value != null && dgv.Cells["VoucherNo"].Value.ToString() != string.Empty && dgv.Cells["voucherTypeId"].Value != null && dgv.Cells["voucherTypeId"].Value.ToString() != string.Empty) { strVoucherType = dgv.Cells["VoucherType"].Value.ToString(); decVouchertypeId = Convert.ToDecimal(dgv.Cells["voucherTypeId"].Value.ToString()); strVoucherNo = dgv.Cells["VoucherNo"].Value.ToString(); } else { if (dgv.Cells["ledgerId"].Value.ToString() != string.Empty) { decledgerId = decimal.Parse(dgv.Cells["ledgerId"].Value.ToString()); strVoucherType = dgv.Cells["Account Ledger"].Value.ToString(); frmLedgerDetails frmLedger = new frmLedgerDetails(); frmLedger = Application.OpenForms["frmLedgerDetails"] as frmLedgerDetails; if (frmLedger == null) { frmLedger = new frmLedgerDetails(); frmLedger.MdiParent = formMDI.MDIObj; frmLedger.callFromAgeing(this, decledgerId); this.Enabled = false; } } } if (dgv.Index == inI) { break; } } if (strVoucherType == "Payment Voucher") { PaymentMasterSP spPaymentMaster = new PaymentMasterSP(); decMasterId = spPaymentMaster.paymentMasterIdView(decVouchertypeId, strVoucherNo); frmPaymentVoucher frmPaymentVoucher = new frmPaymentVoucher(); frmPaymentVoucher = Application.OpenForms["frmPaymentVoucher"] as frmPaymentVoucher; if (frmPaymentVoucher == null) { frmPaymentVoucher = new frmPaymentVoucher(); frmPaymentVoucher.MdiParent = formMDI.MDIObj; frmPaymentVoucher.callFromAgeing(this, decMasterId); this.Enabled = false; } } else if (strVoucherType == "Receipt Voucher") { ReceiptMasterSP spRecieptMaster = new ReceiptMasterSP(); decMasterId = spRecieptMaster.ReceiptMasterIdView(decVouchertypeId, strVoucherNo); frmReceiptVoucher frmReceiptVoucher = new frmReceiptVoucher(); frmReceiptVoucher = Application.OpenForms["frmReceiptVoucher"] as frmReceiptVoucher; if (frmReceiptVoucher == null) { frmReceiptVoucher = new frmReceiptVoucher(); frmReceiptVoucher.MdiParent = formMDI.MDIObj; frmReceiptVoucher.callFromAgeing(this, decMasterId); this.Enabled = false; } } else if (strVoucherType == "Journal Voucher") { JournalMasterSP spJournalMaster = new JournalMasterSP(); decMasterId = spJournalMaster.JournalMasterIdView(decVouchertypeId, strVoucherNo); frmJournalVoucher frmJournalVoucher = new frmJournalVoucher(); frmJournalVoucher = Application.OpenForms["frmJournalVoucher"] as frmJournalVoucher; if (frmJournalVoucher == null) { frmJournalVoucher = new frmJournalVoucher(); frmJournalVoucher.MdiParent = formMDI.MDIObj; frmJournalVoucher.callFromAgeing(this, decMasterId); this.Enabled = false; } } else if (strVoucherType == "PDC Receivable") { PDCReceivableMasterSP spPdcRecievabl = new PDCReceivableMasterSP(); decMasterId = spPdcRecievabl.PdcReceivableMasterIdView(decVouchertypeId, strVoucherNo); frmPdcReceivable frmPdcReceivable = new frmPdcReceivable(); frmPdcReceivable = Application.OpenForms["frmPdcReceivable"] as frmPdcReceivable; if (frmPdcReceivable == null) { frmPdcReceivable = new frmPdcReceivable(); frmPdcReceivable.MdiParent = formMDI.MDIObj; frmPdcReceivable.callFromAgeing(this, decMasterId); this.Enabled = false; } } else if (strVoucherType == "PDC Payable") { PDCPayableMasterSP spPdcPayable = new PDCPayableMasterSP(); decMasterId = spPdcPayable.PdcPayableMasterIdView(decVouchertypeId, strVoucherNo); frmPdcPayable frmPdcPayable = new frmPdcPayable(); frmPdcPayable = Application.OpenForms["frmPdcPayable"] as frmPdcPayable; if (frmPdcPayable == null) { frmPdcPayable = new frmPdcPayable(); frmPdcPayable.MdiParent = formMDI.MDIObj; frmPdcPayable.callFromAgeing(this, decMasterId); this.Enabled = false; } } else if (strVoucherType == "Sales Invoice") { SalesMasterSP spMaster = new SalesMasterSP(); decMasterId = spMaster.SalesMasterIdViewByvoucherNoAndVoucherType(decVouchertypeId, strVoucherNo); SalesMasterSP spSalesMaster = new SalesMasterSP(); bool blPOS = spSalesMaster.DayBookSalesInvoiceOrPOS(decMasterId, decVouchertypeId); frmSalesInvoice frmSalesInvoice = new frmSalesInvoice(); frmPOS frmPOS = new frmPOS(); if (blPOS == true) { frmPOS = Application.OpenForms["frmPOS"] as frmPOS; if (frmPOS == null) { frmPOS = new frmPOS(); frmPOS.MdiParent = formMDI.MDIObj; frmPOS.callFromAgeing(this, decMasterId); this.Enabled = false; } } else { frmSalesInvoice = Application.OpenForms["frmSalesInvoice"] as frmSalesInvoice; if (frmSalesInvoice == null) { frmSalesInvoice = new frmSalesInvoice(); frmSalesInvoice.MdiParent = formMDI.MDIObj; frmSalesInvoice.callFromAgeing(this, decMasterId); this.Enabled = false; } } } else if (strVoucherType == "Purchase Invoice") { PurchaseMasterSP spPurchaseMaster = new PurchaseMasterSP(); decMasterId = spPurchaseMaster.PurchaseMasterIdViewByvoucherNoAndVoucherType(decVouchertypeId, strVoucherNo); frmPurchaseInvoice objpurchase = new frmPurchaseInvoice(); objpurchase.WindowState = FormWindowState.Normal; objpurchase.MdiParent = formMDI.MDIObj; objpurchase.callFromAgeing(this, decMasterId); this.Enabled = false; } else if (strVoucherType == "Credit Note") { CreditNoteMasterSP spCreditNoteMaster = new CreditNoteMasterSP(); decMasterId = spCreditNoteMaster.CreditNoteMasterIdView(decVouchertypeId, strVoucherNo); frmCreditNote objpurchase = new frmCreditNote(); objpurchase.WindowState = FormWindowState.Normal; objpurchase.MdiParent = formMDI.MDIObj; objpurchase.callFromAgeing(this, decMasterId); this.Enabled = false; } else if (strVoucherType == "Debit Note") { DebitNoteMasterSP spDebitNote = new DebitNoteMasterSP(); decMasterId = spDebitNote.DebitNoteMasterIdView(decVouchertypeId, strVoucherNo); frmDebitNote objpurchase = new frmDebitNote(); objpurchase.WindowState = FormWindowState.Normal; objpurchase.MdiParent = formMDI.MDIObj; objpurchase.callFromAgeing(this, decMasterId); this.Enabled = false; } } } } catch (Exception ex) { MessageBox.Show("AR17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Cell double click in grid to view the curresponding item in that form and open the form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvVoucherwiseProductSearch_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex != -1) { int inI = dgvVoucherwiseProductSearch.CurrentCell.RowIndex; foreach (DataGridViewRow dgv in dgvVoucherwiseProductSearch.Rows) { decMasterId = decimal.Parse(dgv.Cells["dgvtxtmasterId"].Value.ToString()); strVoucherType = dgv.Cells["dgvtxtTypeOfVoucher"].Value.ToString(); decVoucherTypeId = Convert.ToDecimal(dgv.Cells["dgvtxtvoucherTypeId"].Value.ToString()); if (dgv.Index == inI) { break; } } if (decMasterId != 0 && strVoucherType == "Material Receipt") { frmMaterialReceipt objReceipt = new frmMaterialReceipt(); objReceipt.WindowState = FormWindowState.Normal; objReceipt.MdiParent = formMDI.MDIObj; objReceipt.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Physical Stock") { frmPhysicalStock objPhysical = new frmPhysicalStock(); objPhysical.WindowState = FormWindowState.Normal; objPhysical.MdiParent = formMDI.MDIObj; objPhysical.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Purchase Invoice") { frmPurchaseInvoice objpurchase = new frmPurchaseInvoice(); objpurchase.WindowState = FormWindowState.Normal; objpurchase.MdiParent = formMDI.MDIObj; objpurchase.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Rejection Out") { frmRejectionOut objRejection = new frmRejectionOut(); objRejection.WindowState = FormWindowState.Normal; objRejection.MdiParent = formMDI.MDIObj; objRejection.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Rejection In") { frmRejectionIn objRejection = new frmRejectionIn(); objRejection.WindowState = FormWindowState.Normal; objRejection.MdiParent = formMDI.MDIObj; objRejection.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Purchase Return") { frmPurchaseReturn objPurchase = new frmPurchaseReturn(); objPurchase.WindowState = FormWindowState.Normal; objPurchase.MdiParent = formMDI.MDIObj; objPurchase.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Sales Return") { frmSalesReturn frmObj = new frmSalesReturn(); frmObj.WindowState = FormWindowState.Normal; frmObj.MdiParent = formMDI.MDIObj; frmObj.CallFromVoucherWiseProductSearch(this, decMasterId, true); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Delivery Note") { frmDeliveryNote objDeliveryReport = new frmDeliveryNote(); objDeliveryReport.WindowState = FormWindowState.Normal; objDeliveryReport.MdiParent = formMDI.MDIObj; objDeliveryReport.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Sales Order") { frmSalesOrder dbjfrmSalesorder = new frmSalesOrder(); dbjfrmSalesorder.WindowState = FormWindowState.Normal; dbjfrmSalesorder.MdiParent = formMDI.MDIObj; dbjfrmSalesorder.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Purchase Order") { frmPurchaseOrder objfrmPurchaseorder = new frmPurchaseOrder(); objfrmPurchaseorder.WindowState = FormWindowState.Normal; objfrmPurchaseorder.MdiParent = formMDI.MDIObj; objfrmPurchaseorder.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Sales Quotation") { frmSalesQuotation objfrmSalesquotation = new frmSalesQuotation(); objfrmSalesquotation.WindowState = FormWindowState.Normal; objfrmSalesquotation.MdiParent = formMDI.MDIObj; objfrmSalesquotation.CallFromVoucherWiseProductSearch(this, decMasterId); this.Enabled = false; } else if (decMasterId != 0 && strVoucherType == "Sales Invoice") { frmSalesInvoice objSalesReport = new frmSalesInvoice(); SalesMasterSP spSalesMaster = new SalesMasterSP(); objSalesReport.WindowState = FormWindowState.Normal; objSalesReport.MdiParent = formMDI.MDIObj; bool blPOS = spSalesMaster.DayBookSalesInvoiceOrPOS(decMasterId, decVoucherTypeId); frmSalesInvoice frmSalesInvoice = new frmSalesInvoice(); frmPOS frmPOS = new frmPOS(); if (blPOS == true) { frmPOS = Application.OpenForms["frmPOS"] as frmPOS; if (frmPOS == null) { frmPOS = new frmPOS(); frmPOS.MdiParent = formMDI.MDIObj; frmPOS.callFromVoucherWiseProductSearch(this, decMasterId); } } else { frmSalesInvoice = Application.OpenForms["frmSalesInvoice"] as frmSalesInvoice; if (frmSalesInvoice == null) { frmSalesInvoice = new frmSalesInvoice(); frmSalesInvoice.MdiParent = formMDI.MDIObj; objSalesReport.CallFromVoucherWiseProductSearch(this, decMasterId); } } this.Enabled = false; } } } catch (Exception ex) { formMDI.infoError.ErrorString = "VPS :11" + ex.Message; } }