Ejemplo n.º 1
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP();
         if (txtDeliveryNoteNo.Text.Trim() == string.Empty)
         {
             strInvoiceNo = string.Empty;
         }
         else
         {
             strInvoiceNo = txtDeliveryNoteNo.Text;
         }
         DateTime FromDate = this.dtpFromDate.Value;
         DateTime ToDate = this.dtpToDate.Value;
         DataTable dtblDeryNote = new DataTable();
         dtblDeryNote = spDeliveryNoteMaster.DeliveryNoteRegisterGridFillCorrespondingToInvoiceNoAndLedger(strInvoiceNo, Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()), FromDate, ToDate, PublicVariables._inNoOfDecimalPlaces);
         dgvDeliveryNoteRegister.DataSource = dtblDeryNote;
     }
     catch (Exception ex)
     {
         MessageBox.Show("DNREG02" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 ///  Grid fill function Againest DeliveryNote
 /// </summary>
 public void gridFillAgainestDeliveryNote()
 {
     DeliveryNoteMasterSP SPDeliveryNoteMaster = new DeliveryNoteMasterSP();
     DeliveryNoteDetailsSP SPDeliveryNoteDetails = new DeliveryNoteDetailsSP();
     ProductInfo infoproduct = new ProductInfo();
     SalesMasterSP spSalesMaster = new SalesMasterSP();
     BrandInfo InfoBrand = new BrandInfo();
     TaxInfo infoTax = new TaxInfo();
     TaxSP SPTax = new TaxSP();
     try
     {
         if (cmbSalesModeOrderNo.SelectedIndex > 0)
         {
             inMaxCount = 0;
             isValueChange = false;
             for (int i = 0; i < dgvSalesInvoice.RowCount - 1; i++)
             {
                 if (dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesDetailsId"].Value != null && dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesDetailsId"].Value.ToString() != string.Empty)
                 {
                     lstArrOfRemove.Add(dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesDetailsId"].Value.ToString());
                 }
             }
             dgvSalesInvoice.Rows.Clear();
             isValueChange = true;
             DataTable dtblMaster = SPDeliveryNoteMaster.SalesInvoiceGridfillAgainestDeliveryNote(Convert.ToDecimal(cmbSalesModeOrderNo.SelectedValue.ToString()));
             cmbPricingLevel.SelectedValue = Convert.ToDecimal(dtblMaster.Rows[0]["pricingLevelId"].ToString());
             cmbCurrency.SelectedValue = Convert.ToDecimal(dtblMaster.Rows[0]["exchangeRateId"].ToString());
             cmbPricingLevel.Enabled = false;
             cmbCurrency.Enabled = false;
             DataTable dtblDetails = SPDeliveryNoteDetails.SalesInvoiceGridfillAgainestDeliveryNoteUsingDeliveryNoteDetails(Convert.ToDecimal(cmbSalesModeOrderNo.SelectedValue.ToString()), decSalesInvoiceIdToEdit, DecSalesInvoiceVoucherTypeId);
             dtblDeliveryNoteDetails = dtblDetails;
             int inRowIndex = 0;
             foreach (DataRow drowDetails in dtblDetails.Rows)
             {
                 dgvSalesInvoice.Rows.Add();
                 IsSetGridValueChange = false;
                 isValueChange = false;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceDeliveryNoteDetailsId"].Value = drowDetails["deliveryNoteDetailsId"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductCode"].Value = drowDetails["productCode"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceBarcode"].Value = drowDetails["barcode"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvcmbSalesInvoiceBatch"].Value = Convert.ToDecimal(drowDetails["batchId"].ToString());
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceVoucherNo"].Value = drowDetails["voucherNo"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceInvoiceNo"].Value = drowDetails["invoiceNo"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceVoucherTypeId"].Value = drowDetails["voucherTypeId"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceDiscountPercentage"].Value = "0";
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceInRowIndex"].Value = drowDetails["deliveryNoteDetailsId"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductId"].Value = drowDetails.ItemArray[2].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceUnitConversionId"].Value = drowDetails["unitConversionId"].ToString();
                 infoproduct = spSalesMaster.ProductViewByProductIdforSalesInvoice(Convert.ToDecimal(dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductId"].Value).ToString());
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductName"].Value = infoproduct.ProductName;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceMrp"].Value = infoproduct.Mrp;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoicePurchaseRate"].Value = infoproduct.PurchaseRate;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceSalesRate"].Value = infoproduct.SalesRate;
                 InfoBrand = new BrandSP().BrandView(infoproduct.BrandId);
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceBrand"].Value = InfoBrand.BrandName;
                 infoTax = SPTax.TaxViewByProductId(Convert.ToDecimal(dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductId"].Value).ToString());
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvcmbSalesInvoiceTaxName"].Value = infoTax.TaxId;
                 isValueChange = false;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoicembUnitName"].Value = Convert.ToDecimal(drowDetails["unitId"].ToString());
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoicembUnitName"].ReadOnly = true;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceQty"].Value = drowDetails["Qty"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceRate"].Value = drowDetails["rate"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceAmount"].Value = drowDetails["amount"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceConversionRate"].Value = drowDetails["conversionRate"].ToString();
                 isFromAgainest = true;
                 gridColumnMakeEnables();
                 int intIndex = 0;
                 intIndex = Convert.ToInt32(drowDetails["deliveryNoteDetailsId"].ToString());
                 if (inMaxCount < intIndex)
                     inMaxCount = intIndex;
                 inRowIndex++;
                 isValueChange = true;
                 isFromAgainest = false;
                 GrossValueCalculation(dgvSalesInvoice.Rows.Count - 2);
                 discountCalculation(dgvSalesInvoice.Rows.Count - 2);
                 taxAndGridTotalAmountCalculation(dgvSalesInvoice.Rows.Count - 2);
             }
             IsSetGridValueChange = true;
             for (int i = inRowIndex; i < dgvSalesInvoice.Rows.Count; ++i)
                 dgvSalesInvoice["dgvtxtSalesInvoiceInRowIndex", i].Value = GetNextinRowIndex().ToString();
             SerialNoforSalesInvoice();
             strVoucherNoTostockPost = dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceVoucherNo"].Value.ToString();
             strInvoiceNoTostockPost = dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceInvoiceNo"].Value.ToString();
             decVouchertypeIdTostockPost = Convert.ToDecimal(dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceVoucherTypeId"].Value);
         }
         else
         {
             SiGridTotalAmountCalculation();
             ClearGridAgainest();
         }
         SiGridTotalAmountCalculation();
     }
     catch (Exception ex)
     {
         MessageBox.Show("SI: 53" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// To fill the grid according to the pending Sales order Invoice number
 /// </summary>
 public void FillOrderDetails()
 {
     decimal decOrderNo = 0;
     try
     {
         DeliveryNoteMasterInfo infoDeliveryNoteMaster = new DeliveryNoteMasterInfo();
         DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP();
         decOrderNo = Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString());
         inMaxCount = 0;
         string strSalesManId;
         decimal DefaultRate = 0;
         dgvProduct.Rows.Clear();
         DataTable dtblMaster = new SalesOrderMasterSP().SalesOrderMasterViewBySalesOrderMasterId(Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()));
         cmbPricingLevel.SelectedValue = dtblMaster.Rows[0]["pricingLevelId"].ToString();
         if (dtblMaster.Rows[0]["employeeId"].ToString() != string.Empty)
         {
             strSalesManId = dtblMaster.Rows[0]["employeeId"].ToString();
             cmbSalesMan.SelectedValue = strSalesManId;
             SalesManComboFill();
             cmbSalesMan.SelectedValue = dtblMaster.Rows[0]["employeeId"].ToString();
         }
         CurrencyComboFill();
         cmbCurrency.SelectedValue = dtblMaster.Rows[0]["exchangeRateId"].ToString();
         DataTable dtblDetails = new SalesOrderDetailsSP().SalesOrderDetailsViewBySalesOrderMasterIdWithRemaining(decOrderNo, 0);
         int inRowIndex = 0;
         isValueChange = false;
         isDoAfterGridFill = false;
         infoDeliveryNoteMaster = spDeliveryNoteMaster.DeliveryNoteMasterViewAllByMasterId(decDelivryNoteIdToEdit);
         foreach (DataRow drowDetails in dtblDetails.Rows)
         {
             dgvProduct.Rows.Add();
             dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].Value = drowDetails["barcode"].ToString();
             dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductCode"].Value = drowDetails["productCode"].ToString();
             dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductId"].Value = drowDetails["productId"].ToString();
             dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"].Value = drowDetails["productName"].ToString();
             dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtQty"].Value = drowDetails["qty"].ToString();
             string ProductId = drowDetails.ItemArray[2].ToString();
             UnitComboFill1(Convert.ToDecimal(ProductId), 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());
             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());
             dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtRate"].Value = drowDetails["rate"].ToString();
             DefaultRate = Convert.ToDecimal(dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtRate"].Value.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["dgvtxtOrderDetailsId"].Value = drowDetails["salesOrderDetailsId"].ToString();
             dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtVoucherTypeId"].Value = drowDetails["voucherTypeId"].ToString();
             dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtVoucherNo"].Value = drowDetails["voucherNo"].ToString();
             dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtInvoiceNo"].Value = drowDetails["invoiceNo"].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();
             if (cmbOrderNo.Visible == true)
             {
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ReadOnly = true;
             }
             dgvProduct.Rows[dgvProduct.Rows.Count - 2].HeaderCell.Value = "";
             AmountCalculation("dgvtxtQty", inRowIndex);
             int inIndex = 0;
             int.TryParse(drowDetails["extra1"].ToString(), out inIndex);
             if (inMaxCount < inIndex)
                 inMaxCount = inIndex;
             inRowIndex++;
             isValueChange = true;
         }
         for (int i = inRowIndex; i < dgvProduct.Rows.Count; ++i)
             dgvProduct["inRowIndex", i].Value = GetNextinRowIndex().ToString();
         SerialNo();
         TotalAmountCalculation();
         isDoAfterGridFill = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("DN27 :" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 4
0
        /// <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();
                VoucherTypeSP spVoucherType = new VoucherTypeSP();
                DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP();
                DeliveryNoteDetailsSP spDeliveryNoteDetails = new DeliveryNoteDetailsSP();
                SalesOrderMasterInfo infoSalesOrderMaster = new SalesOrderMasterInfo();
                SalesOrderMasterSP spSalesOrderMaster = new SalesOrderMasterSP();
                SalesQuotationMasterInfo infoSalesQuotationMaster = new SalesQuotationMasterInfo();
                SalesQuotationMasterSP spSalesQuotationMaster = new SalesQuotationMasterSP();
                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 = spDeliveryNoteMaster.DeliveryNoteMasterViewAllByMasterId(decDelivryNoteIdToEdit);
                txtDeliveryNoteNo.Text = infoDeliveryNoteMaster.InvoiceNo;
                strVoucherNo = infoDeliveryNoteMaster.VoucherNo.ToString();
                decDeliveryNoteSuffixPrefixId = Convert.ToDecimal(infoDeliveryNoteMaster.SuffixPrefixId);
                decDeliveryNoteVoucherTypeId = Convert.ToDecimal(infoDeliveryNoteMaster.VoucherTypeId);
                isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decDeliveryNoteVoucherTypeId);
                decDeliveryNoteTypeId = decDeliveryNoteVoucherTypeId;
                cmbCashOrParty.SelectedValue = infoDeliveryNoteMaster.LedgerId;
                txtDate.Text = infoDeliveryNoteMaster.Date.ToString("dd-MMM-yyyy");
                cmbPricingLevel.SelectedValue = infoDeliveryNoteMaster.PricinglevelId;
                infoVoucherType = spVoucherType.VoucherTypeView(decDeliveryNoteVoucherTypeId);
                this.Text = infoVoucherType.VoucherTypeName;
                if (infoDeliveryNoteMaster.OrderMasterId != 0)
                {
                    cmbDeliveryMode.Text = "Against Order";
                    infoSalesOrderMaster = spSalesOrderMaster.SalesOrderMasterView(infoDeliveryNoteMaster.OrderMasterId);
                    cmbType.SelectedValue = infoSalesOrderMaster.VoucherTypeId;
                    AgainstOrderComboFill();
                    cmbOrderNo.SelectedValue = infoDeliveryNoteMaster.OrderMasterId;
                }
                else if (infoDeliveryNoteMaster.QuotationMasterId != 0)
                {
                    cmbDeliveryMode.Text = "Against Quotation";
                    infoSalesQuotationMaster = spSalesQuotationMaster.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");
                DataTable dtblDetails = spDeliveryNoteDetails.DeliveryNoteDetailsViewByDeliveryNoteMasterId(decDelivryNoteIdToEdit);
                foreach (DataRow drowDetails in dtblDetails.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 (spDeliveryNoteMaster.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);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 ///to change the corresponding values in grid when cells changed 
 /// </summary>
 private void dgvProduct_CellLeave(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         SalesQuotationDetailsSP spQuotationDetails = new SalesQuotationDetailsSP();
         DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP();
         if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtQty")
         {
             decimal decCurrentQty = 0;
             decimal decOldQty = 0;
             if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value.ToString() != string.Empty)
             {
                 if (decDelivryNoteIdToEdit != 0)
                 {
                     if (cmbOrderNo.SelectedIndex != 0)
                     {
                         if (cmbDeliveryMode.Text == "Against Order")
                         {
                             DataTable dtblDetails = new SalesOrderDetailsSP().SalesOrderDetailsViewBySalesOrderMasterIdWithRemaining(Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()), decDelivryNoteIdToEdit);
                             decCurrentQty = Convert.ToDecimal(dgvProduct.Rows[0].Cells["dgvtxtQty"].Value.ToString());
                             decOldQty = Convert.ToDecimal(dtblDetails.Rows[0]["qty"].ToString());
                         }
                         else if (cmbDeliveryMode.Text == "Against Quotation")
                         {
                             DataTable dtblQuotationDetails = spQuotationDetails.SalesQuotationDetailsViewByquotationMasterIdWithRemainingByNotInCurrDN(Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()), decDelivryNoteIdToEdit);
                             if (dtblQuotationDetails.Rows.Count >= 1)
                             {
                                 decCurrentQty = Convert.ToDecimal(dgvProduct.Rows[0].Cells["dgvtxtQty"].Value.ToString());
                                 decOldQty = Convert.ToDecimal(dtblQuotationDetails.Rows[0]["qty"].ToString());
                             }
                         }
                         if (spDeliveryNoteMaster.DeliveryNoteMasterReferenceCheckRejectionIn(decDelivryNoteIdToEdit))
                         {
                             DataTable dtblRejectionInQty = new DataTable();
                             dtblRejectionInQty = spDeliveryNoteMaster.DeliveryNoteMasterReferenceCheckRejectionInQty(decDelivryNoteIdToEdit);
                             decimal decRejectionInQty = decimal.Parse(dtblRejectionInQty.Rows[e.RowIndex]["qty"].ToString());
                             if (decimal.Parse(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value.ToString()) > decimal.Parse(dtblRejectionInQty.Rows[e.RowIndex]["qty"].ToString()))
                             {
                                 decCurrentQty = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value.ToString());
                             }
                             else
                             {
                                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value = Convert.ToDecimal(decRejectionInQty);
                             }
                         }
                         if (spDeliveryNoteMaster.DeliveryNoteCheckReferenceInSalesInvoice(decDelivryNoteIdToEdit))
                         {
                             DataTable dtblSalesInvoiceQty = new DataTable();
                             dtblSalesInvoiceQty = spDeliveryNoteMaster.DeliveryNoteMasterReferenceCheckSalesInvoiceQty(decDelivryNoteIdToEdit);
                             decimal decSalesInvoiceQty = decimal.Parse(dtblSalesInvoiceQty.Rows[e.RowIndex]["qty"].ToString());
                             if (decimal.Parse(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value.ToString()) > decimal.Parse(dtblSalesInvoiceQty.Rows[e.RowIndex]["qty"].ToString()))
                             {
                                 decCurrentQty = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value.ToString());
                             }
                             else
                             {
                                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value = Convert.ToDecimal(decSalesInvoiceQty);
                             }
                         }
                     }
                     else
                     {
                         Messages.InformationMessage("Select OrderNo");
                         cmbOrderNo.Focus();
                     }
                 }
                 if (decDelivryNoteIdToEdit == 0)
                 {
                     if (Convert.ToInt32(dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtOrderDetailsId"].Value) != 0)
                     {
                         if (cmbDeliveryMode.Text == "Against Quotation")
                         {
                             DataTable dtbl1 = spQuotationDetails.SalesQuotationDetailsViewByquotationMasterIdWithRemainingByNotInCurrDN(Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()), decDelivryNoteIdToEdit);
                             decCurrentQty = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value.ToString());
                             decOldQty = Convert.ToDecimal(dtbl1.Rows[e.RowIndex]["qty"].ToString());
                         }
                         else if (cmbDeliveryMode.Text == "Against Order")
                         {
                             DataTable dtbl2 = new SalesOrderDetailsSP().SalesOrderDetailsViewBySalesOrderMasterIdWithRemaining(Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()), decDelivryNoteIdToEdit);
                             decCurrentQty = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value.ToString());
                             decOldQty = Convert.ToDecimal(dtbl2.Rows[e.RowIndex]["qty"].ToString());
                         }
                     }
                 }
             }
         }
         if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvcmbUnit")
         {
             if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value.ToString() != string.Empty)
             {
                 if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value.ToString() != string.Empty)
                 {
                     UnitConvertionSP SpUnitConvertion = new UnitConvertionSP();
                     DataTable dtblUnitByProduct = new DataTable();
                     dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductId"].Value.ToString());
                     foreach (DataRow drUnitByProduct in dtblUnitByProduct.Rows)
                     {
                         if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString())
                         {
                             dgvProduct.Rows[e.RowIndex].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString());
                             dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString());
                             if (isDoAfterGridFill)
                             {
                                 decimal decNewConversionRate = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value.ToString());
                                 decimal decNewRate = (decCurrentRate * decCurrentConversionRate) / decNewConversionRate;
                                 dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = Math.Round(decNewRate, 2);
                             }
                         }
                     }
                 }
             }
         }
         if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtQty")
         {
             AmountCalculation("dgvtxtQty", e.RowIndex);
         }
         if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtRate")
         {
             AmountCalculation("dgvtxtRate", e.RowIndex);
         }
         else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtAmount")
         {
             TotalAmountCalculation();
         }
         CheckInvalidEntries(e);
     }
     catch (Exception ex)
     {
         MessageBox.Show("DN70:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Function to generate Voucher number as per settings
 /// </summary>
 public void VoucherNumberGeneration()
 {
     SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo();
     TransactionsGeneralFill TransactionGenerateFillObj = new TransactionsGeneralFill();
     DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP();
     string tableName = "DeliveryNoteMaster";
     string strPrefix = string.Empty;
     string strSuffix = string.Empty;
     try
     {
         strVoucherNo = "0";
         if (strVoucherNo == string.Empty)
         {
             strVoucherNo = "0";
         }
         strVoucherNo = TransactionGenerateFillObj.VoucherNumberAutomaicGeneration(decDeliveryNoteVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName);
         if (Convert.ToDecimal(strVoucherNo) != spDeliveryNoteMaster.DeliveryNoteMasterGetMaxPlusOne(decDeliveryNoteVoucherTypeId))
         {
             strVoucherNo = spDeliveryNoteMaster.DeliveryNoteMasterMax1(decDeliveryNoteVoucherTypeId).ToString();
             strVoucherNo = TransactionGenerateFillObj.VoucherNumberAutomaicGeneration(decDeliveryNoteVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName);
             if (spDeliveryNoteMaster.DeliveryNoteMasterMax1(decDeliveryNoteVoucherTypeId) == "0")
             {
                 strVoucherNo = "0";
                 strVoucherNo = TransactionGenerateFillObj.VoucherNumberAutomaicGeneration(decDeliveryNoteVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName);
             }
         }
         if (isAutomatic)
         {
             infoSuffixPrefix = new SuffixPrefixSP().GetSuffixPrefixDetails(decDeliveryNoteVoucherTypeId, dtpDate.Value);
             strPrefix = infoSuffixPrefix.Prefix;
             strSuffix = infoSuffixPrefix.Suffix;
             decDeliveryNoteSuffixPrefixId = infoSuffixPrefix.SuffixprefixId;
             strDeliveryNoteNo = strPrefix + strVoucherNo + strSuffix;
             txtDeliveryNoteNo.Text = strDeliveryNoteNo;
             txtDeliveryNoteNo.ReadOnly = true;
         }
         else
         {
             txtDeliveryNoteNo.Text = string.Empty;
             strDeliveryNoteNo = txtDeliveryNoteNo.Text.Trim();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("DN09:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Delete Function
 /// </summary>
 public void Delete()
 {
     try
     {
         DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP();
         DeliveryNoteDetailsSP spDeliveryNoteDetails = new DeliveryNoteDetailsSP();
         StockPostingSP spStockPosting = new StockPostingSP();
         if (!spDeliveryNoteMaster.DeliveryNoteCheckReferenceInSalesInvoice(decDelivryNoteIdToEdit))
         {
             decimal decResult1 = 0;
             decimal decResult2 = spDeliveryNoteMaster.DeliveryNoteMasterDelete(decDelivryNoteIdToEdit);
             for (int inI = 0; inI < dgvProduct.Rows.Count - 1; inI++)
             {
                 if (Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtDetailsId"].Value) != 0)
                 {
                     decResult1 = spDeliveryNoteDetails.DeliveryNoteDetailsDelete(Convert.ToDecimal(dgvProduct.Rows[0].Cells["dgvtxtDetailsId"].Value.ToString()));
                 }
             }
             spStockPosting.StockPostingDeleteByVoucherTypeAndVoucherNo(strVoucherNo, decDeliveryNoteVoucherTypeId);
             if (decResult2 > 0)
             {
                 Messages.DeletedMessage();
             }
             else
             {
                 Messages.ReferenceExistsMessage();
             }
             if (frmDeliveryNoteRegisterObj != null)
             {
                 this.Close();
                 frmDeliveryNoteRegisterObj.GridFill();
             }
             if (frmDeliveryNoteReportObj != null)
             {
                 this.Close();
                 frmDeliveryNoteReportObj.GridFill();
             }
             if (frmDayBookObj != null)
             {
                 this.Close();
             }
             if (objVoucherSearch != null)
             {
                 this.Close();
             }
             if (objVoucherProduct != null)
             {
                 this.Close();
             }
         }
         else
         {
             Messages.ReferenceExistsMessage();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("DN42:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Print button click, to print the selected details
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     decimal decVoucherTypeId = 0;
     try
     {
         string strDeliveryMode = cmbDeliveryMode.Text;
         string strInvoiceNo = cmbOrderNo.Text;
         DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP();
         if (dgvDeliveryNoteReport.RowCount > 0)
         {
             if (cmbVoucherType.Text == "All")
             {
                 decVoucherTypeId = 0;
             }
             else
             {
                 decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString());
             }
             DataSet dsDeliveryNoteReport = spDeliveryNoteMaster.DeliveryNoteReportPrinting(1, Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()), decVoucherTypeId, this.dtpFromDate.Value, this.dtpToDate.Value, cmbStatus.Text, strDeliveryMode,strInvoiceNo);
             frmReport frmReport = new frmReport();
             frmReport.MdiParent = formMDI.MDIObj;
             frmReport.DeliveryNoteReportPrinting(dsDeliveryNoteReport);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("DNREP10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Save or Edit Function checking invalid entries here
        /// </summary>
        public void SaveOrEdit()
        {
            try
            {
                DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP();
                string strDeliveryModeText = string.Empty;
                cmbDeliveryMode.Text = strDeliveryModeText;
                dgvProduct.ClearSelection();
                int inRow = dgvProduct.RowCount;

                if (txtDeliveryNoteNo.Text.Trim() == string.Empty && decDeliveryNoteMasterId == 0)
                {
                    Messages.InformationMessage("Enter Delivery Note Number");
                    txtDeliveryNoteNo.Focus();
                }
                else if (spDeliveryNoteMaster.DeliveryNotNumberCheckExistence(txtDeliveryNoteNo.Text.Trim(), 0, decDeliveryNoteVoucherTypeId) == true && btnSave.Text == "Save")
                {
                    Messages.InformationMessage("Number already exist");
                    txtDeliveryNoteNo.Focus();
                }
                else if (txtDate.Text.Trim() == string.Empty && decDeliveryNoteMasterId == 0)
                {
                    Messages.InformationMessage("Select a date in between financial year");
                    txtDate.Focus();
                }
                else if (cmbCashOrParty.SelectedValue == null && decDeliveryNoteMasterId == 0)
                {
                    Messages.InformationMessage("Select Cash/Party");
                    cmbCashOrParty.Focus();
                }
                else if (cmbPricingLevel.SelectedValue == null && decDeliveryNoteMasterId == 0)
                {
                    Messages.InformationMessage("Select PricingLevel");
                    cmbPricingLevel.Focus();
                }
                else if (cmbDeliveryMode.Text == null && decDeliveryNoteMasterId == 0)
                {
                    Messages.InformationMessage("Select DeliveryMode");
                    cmbDeliveryMode.Focus();
                }
                else if (cmbDeliveryMode.SelectedIndex != 0 && cmbOrderNo.Text == string.Empty)
                {
                    Messages.InformationMessage("Select OrderNo");
                    cmbOrderNo.Focus();
                }
                else if (cmbSalesMan.SelectedValue == null && decDeliveryNoteMasterId == 0)
                {
                    Messages.InformationMessage("Select Salesman");
                    cmbSalesMan.Focus();
                }
                else if (cmbCurrency.SelectedValue == null && decDeliveryNoteMasterId == 0)
                {
                    Messages.InformationMessage("Select Currency");
                    cmbCurrency.Focus();
                }
                else if (RemoveIncompleteRowsFromGrid())
                {
                    if (dgvProduct.Rows[0].Cells["dgvcmbUnit"].Value == null || dgvProduct.Rows[0].Cells["dgvtxtProductName"].Value == null && dgvProduct.Rows[0].Cells["dgvtxtProductCode"].Value == null)
                    {
                        MessageBox.Show("Can't save Delivery note details without atleast one product with complete details", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        dgvProduct.ClearSelection();
                        dgvProduct.Focus();
                        goto Exit;
                    }
                    else
                    {
                        if (btnSave.Text == "Save")
                        {

                            if (dgvProduct.Rows[0].Cells["dgvtxtProductName"].Value == null || dgvProduct.Rows[0].Cells["dgvtxtQty"].Value == null || dgvProduct.Rows[0].Cells["dgvcmbRack"].Value == null
                                || dgvProduct.Rows[0].Cells["dgvcmbRack"].Value == null || dgvProduct.Rows[0].Cells["dgvtxtAmount"].Value == null ||
                                dgvProduct.Rows[0].Cells["dgvtxtRate"].Value == null || dgvProduct.Rows[0].Cells["dgvcmbGodown"].Value == null)
                            {
                                MessageBox.Show("Can't save Delivery note details without atleast one product with complete details", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                dgvProduct.ClearSelection();
                                dgvProduct.Focus();
                                goto Exit;
                            }

                            if (PublicVariables.isMessageAdd)
                            {
                                if (Messages.SaveMessage())
                                {
                                    SaveFunction();
                                }
                            }
                            else
                            {
                                SaveFunction();
                            }
                        }
                        else if (btnSave.Text == "Update")
                        {
                            if (dgvProduct.Rows[0].Cells["dgvtxtProductName"].Value == null || dgvProduct.Rows[0].Cells["dgvtxtQty"].Value == null || dgvProduct.Rows[0].Cells["dgvcmbRack"].Value == null
                               || dgvProduct.Rows[0].Cells["dgvcmbUnit"].Value == null || dgvProduct.Rows[0].Cells["dgvcmbRack"].Value == null || dgvProduct.Rows[0].Cells["dgvtxtAmount"].Value == null ||
                               dgvProduct.Rows[0].Cells["dgvtxtRate"].Value == null)
                            {
                                MessageBox.Show("Can't save Delivery note details without atleast one product with complete details", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                dgvProduct.ClearSelection();
                                dgvProduct.Focus();
                                goto Exit;
                            }
                            if (PublicVariables.isMessageEdit)
                            {
                                if (Messages.UpdateMessage())
                                {
                                    SaveFunction();
                                }
                            }
                            else
                            {
                                SaveFunction();
                            }
                        }
                    }
                }
            Exit: ;
            }
            catch (Exception ex)
            {
                MessageBox.Show("DN39:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Save Function
        /// </summary>
        public void SaveFunction()
        {
            try
            {
                DeliveryNoteMasterInfo infoDeliveryNoteMaster = new DeliveryNoteMasterInfo();
                DeliveryNoteDetailsInfo infoDeliveryNoteDetails = new DeliveryNoteDetailsInfo();
                StockPostingInfo infoStockPosting = new StockPostingInfo();
                StockPostingSP spStockPosting = new StockPostingSP();
                DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP();
                DeliveryNoteDetailsSP spDeliveryNoteDetails = new DeliveryNoteDetailsSP();
                SalesOrderMasterInfo infoSalesOrderMaster = new SalesOrderMasterInfo();
                SalesOrderMasterSP spSalesOrderMaster = new SalesOrderMasterSP();
                SalesQuotationMasterInfo infoSalesQuotationMaster = new SalesQuotationMasterInfo();
                SalesQuotationMasterSP spSalesQuotationMaster = new SalesQuotationMasterSP();
                infoDeliveryNoteMaster.InvoiceNo = txtDeliveryNoteNo.Text;
                infoDeliveryNoteMaster.VoucherTypeId = decDeliveryNoteVoucherTypeId;
                infoDeliveryNoteMaster.Date = Convert.ToDateTime(txtDate.Text);
                infoDeliveryNoteMaster.LedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString());
                infoDeliveryNoteMaster.VoucherNo = strVoucherNo;
                infoDeliveryNoteMaster.SuffixPrefixId = decDeliveryNoteSuffixPrefixId;
                if (btnSave.Text == "Save")
                {
                    if (cmbOrderNo.SelectedValue != null)
                    {
                        if (cmbDeliveryMode.Text == "Against Order")
                        {
                            infoDeliveryNoteMaster.OrderMasterId = Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString());
                            infoSalesOrderMaster = spSalesOrderMaster.SalesOrderMasterView(infoDeliveryNoteMaster.OrderMasterId);
                        }
                        else if (cmbDeliveryMode.Text == "Against Quotation")
                        {
                            infoDeliveryNoteMaster.QuotationMasterId = Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString());
                            infoSalesQuotationMaster = spSalesQuotationMaster.SalesQuotationMasterView(infoDeliveryNoteMaster.QuotationMasterId);
                        }
                        else if (cmbDeliveryMode.Text == "NA")
                        {
                            infoDeliveryNoteMaster.OrderMasterId = 0; infoDeliveryNoteMaster.QuotationMasterId = 0;
                        }
                    }
                    else
                    {
                        infoDeliveryNoteMaster.OrderMasterId = 0;
                        infoDeliveryNoteMaster.QuotationMasterId = 0;
                    }
                    infoDeliveryNoteMaster.PricinglevelId = Convert.ToDecimal(cmbPricingLevel.SelectedValue.ToString());
                    if (cmbSalesMan.SelectedIndex != -1)
                    {
                        infoDeliveryNoteMaster.EmployeeId = Convert.ToDecimal(cmbSalesMan.SelectedValue.ToString());
                    }
                    else
                    {
                        infoDeliveryNoteMaster.EmployeeId = 0;
                    }
                    infoDeliveryNoteMaster.Narration = txtNarration.Text;
                    infoDeliveryNoteMaster.TotalAmount = Convert.ToDecimal(txtTotalAmnt.Text);
                    infoDeliveryNoteMaster.UserId = PublicVariables._decCurrentUserId;
                    infoDeliveryNoteMaster.LrNo = txtLRNo.Text;
                    infoDeliveryNoteMaster.TransportationCompany = txtTraspotationCompany.Text;
                    infoDeliveryNoteMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
                    infoDeliveryNoteMaster.Extra1 = string.Empty;
                    infoDeliveryNoteMaster.Extra2 = string.Empty;
                    infoDeliveryNoteMaster.ExchangeRateId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
                    if (decDelivryNoteIdToEdit == 0)
                    {
                        decDeliveryNoteMasterId = Convert.ToDecimal(spDeliveryNoteMaster.DeliveryNoteMasterAdd(infoDeliveryNoteMaster));
                    }
                    int inRowcount = dgvProduct.Rows.Count;
                    for (int inI = 0; inI < inRowcount - 1; inI++)
                    {
                        if (dgvProduct.Rows[inI].Cells["dgvtxtDetailsId"].Value == null)
                        {
                            if (cmbDeliveryMode.Text == "Against Order")
                            {
                                if (dgvProduct.Rows[inI].Cells["dgvtxtOrderDetailsId"].Value != null)
                                {
                                    infoDeliveryNoteDetails.OrderDetails1Id = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtOrderDetailsId"].Value == null ? string.Empty : dgvProduct.Rows[inI].Cells["dgvtxtOrderDetailsId"].Value.ToString());
                                }
                                else
                                {
                                    infoDeliveryNoteDetails.OrderDetails1Id = 0;
                                    infoDeliveryNoteDetails.QuotationDetails1Id = 0;
                                }
                            }
                            else if (cmbDeliveryMode.Text == "Against Quotation")
                            {
                                if (dgvProduct.Rows[inI].Cells["dgvtxtOrderDetailsId"].Value != null)
                                {
                                    infoDeliveryNoteDetails.QuotationDetails1Id = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtOrderDetailsId"].Value == null ? string.Empty : dgvProduct.Rows[inI].Cells["dgvtxtOrderDetailsId"].Value.ToString());
                                }
                                else
                                {
                                    infoDeliveryNoteDetails.OrderDetails1Id = 0;
                                    infoDeliveryNoteDetails.QuotationDetails1Id = 0;
                                }
                            }
                            else if (cmbDeliveryMode.Text == "NA")
                            {
                                infoDeliveryNoteDetails.OrderDetails1Id = 0;
                                infoDeliveryNoteDetails.QuotationDetails1Id = 0;
                            }
                        }
                        else
                        {
                            if (cmbOrderNo.SelectedText != string.Empty)
                            {
                                if (cmbDeliveryMode.Text == "Against Order")
                                {
                                    infoDeliveryNoteDetails.OrderDetails1Id = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtOrderDetailsId"].Value.ToString());
                                }
                                else if (cmbDeliveryMode.Text == "Against Quotation")
                                {
                                    infoDeliveryNoteDetails.QuotationDetails1Id = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtOrderDetailsId"].Value.ToString());
                                }
                                else if (cmbDeliveryMode.Text == "NA")
                                {
                                    infoDeliveryNoteDetails.OrderDetails1Id = 0;
                                    infoDeliveryNoteDetails.QuotationDetails1Id = 0;
                                }
                            }
                            else
                            {
                                infoDeliveryNoteDetails.OrderDetails1Id = 0;
                                infoDeliveryNoteDetails.QuotationDetails1Id = 0;
                            }
                        }
                        infoDeliveryNoteDetails.ProductId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtProductId"].Value.ToString());
                        infoDeliveryNoteDetails.Qty = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtQty"].Value.ToString());
                        infoDeliveryNoteDetails.Rate = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtRate"].Value.ToString());
                        infoDeliveryNoteDetails.UnitId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value.ToString());
                        infoDeliveryNoteDetails.Amount = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtAmount"].Value.ToString());
                        infoDeliveryNoteDetails.UnitConversionId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtUnitConversionId"].Value.ToString());
                        infoDeliveryNoteDetails.RackId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbRack"].Value.ToString());
                        infoDeliveryNoteDetails.BatchId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbBatch"].Value.ToString());
                        infoDeliveryNoteDetails.GodownId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbGodown"].Value.ToString());
                        infoDeliveryNoteDetails.SlNo = Convert.ToInt32(dgvProduct.Rows[inI].Cells["Col"].Value.ToString());
                        infoDeliveryNoteDetails.Extra1 = string.Empty;
                        infoDeliveryNoteDetails.Extra2 = string.Empty;
                        if (decDelivryNoteIdToEdit == 0)
                        {
                            infoDeliveryNoteDetails.DeliveryNoteMasterId = decDeliveryNoteMasterId;
                            spDeliveryNoteDetails.DeliveryNoteDetailsAdd(infoDeliveryNoteDetails);
                        }
                        else
                        {
                            infoDeliveryNoteDetails.DeliveryNoteMasterId = decDelivryNoteIdToEdit;
                            spDeliveryNoteDetails.DeliveryNoteDetailsEdit(infoDeliveryNoteDetails);
                        }
                        infoStockPosting.Date = Convert.ToDateTime(txtDate.Text);
                        if (dgvProduct.Rows[inI].Cells["dgvtxtVoucherTypeId"].Value != null)
                        {
                            if (cmbDeliveryMode.SelectedItem.ToString() != "NA")
                            {
                                if (dgvProduct.Rows[inI].Cells["dgvtxtVoucherTypeId"].Value != null)
                                {
                                    infoStockPosting.VoucherTypeId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtVoucherTypeId"].Value);
                                }
                                else
                                {
                                    infoStockPosting.VoucherTypeId = 0;
                                }
                                if (dgvProduct.Rows[inI].Cells["dgvtxtVoucherNo"].Value != null)
                                {
                                    infoStockPosting.VoucherNo = dgvProduct.Rows[inI].Cells["dgvtxtVoucherNo"].Value.ToString();
                                }
                                else
                                {
                                    infoStockPosting.VoucherNo = string.Empty;
                                }
                                if (dgvProduct.Rows[inI].Cells["dgvtxtInvoiceNo"].Value != null)
                                {
                                    infoStockPosting.InvoiceNo = dgvProduct.Rows[inI].Cells["dgvtxtInvoiceNo"].Value.ToString();
                                }
                                else
                                {
                                    infoStockPosting.InvoiceNo = string.Empty;
                                }
                                if (decDeliveryNoteVoucherTypeId != 0)
                                {
                                    infoStockPosting.AgainstVoucherTypeId = decDeliveryNoteVoucherTypeId;
                                }
                                else
                                {
                                    infoStockPosting.AgainstVoucherTypeId = 0;
                                }
                                if (strVoucherNo != string.Empty)
                                {
                                    infoStockPosting.AgainstVoucherNo = strVoucherNo;
                                }
                                else
                                {
                                    infoStockPosting.AgainstVoucherNo = string.Empty;
                                }
                                if (txtDeliveryNoteNo.Text != string.Empty)
                                {
                                    infoStockPosting.AgainstInvoiceNo = txtDeliveryNoteNo.Text;
                                }
                                else
                                {
                                    infoStockPosting.AgainstInvoiceNo = string.Empty;
                                }
                            }
                        }
                        else
                        {
                            infoStockPosting.InvoiceNo = txtDeliveryNoteNo.Text;
                            infoStockPosting.VoucherNo = strVoucherNo;
                            infoStockPosting.VoucherTypeId = decDeliveryNoteVoucherTypeId;
                            infoStockPosting.AgainstVoucherTypeId = 0;
                            infoStockPosting.AgainstVoucherNo = "NA";
                            infoStockPosting.AgainstInvoiceNo = "NA";
                        }
                        infoStockPosting.ProductId = infoDeliveryNoteDetails.ProductId;
                        infoStockPosting.BatchId = infoDeliveryNoteDetails.BatchId;
                        infoStockPosting.UnitId = infoDeliveryNoteDetails.UnitId;
                        infoStockPosting.GodownId = infoDeliveryNoteDetails.GodownId;
                        infoStockPosting.RackId = infoDeliveryNoteDetails.RackId;
                        infoStockPosting.OutwardQty = infoDeliveryNoteDetails.Qty;
                        infoStockPosting.Rate = infoDeliveryNoteDetails.Rate;
                        infoStockPosting.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
                        infoStockPosting.Extra1 = string.Empty;
                        infoStockPosting.Extra2 = string.Empty;
                        spStockPosting.StockPostingAdd(infoStockPosting);
                    }
                    Messages.SavedMessage();
                    if (cbxPrint.Checked)
                    {
                        SettingsSP spSettings = new SettingsSP();
                        if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                        {
                            PrintForDotMatrix(decDeliveryNoteMasterId);
                        }
                        else
                        {
                            Print(decDeliveryNoteMasterId);
                        }
                    }
                }
                if (btnSave.Text == "Update")
                {
                    SettingsSP spSettings = new SettingsSP();
                    infoDeliveryNoteMaster.DeliveryNoteMasterId = decDelivryNoteIdToEdit;
                    infoDeliveryNoteMaster.SuffixPrefixId = Convert.ToDecimal(decDeliveryNoteSuffixPrefixId);
                    infoDeliveryNoteMaster.VoucherNo = strVoucherNo;
                    infoDeliveryNoteMaster.UserId = PublicVariables._decCurrentUserId;//by default current userid used as current employeeid
                    infoDeliveryNoteMaster.PricinglevelId = Convert.ToDecimal(cmbPricingLevel.SelectedValue.ToString());
                    if (cmbSalesMan.SelectedIndex != -1)
                    {
                        infoDeliveryNoteMaster.EmployeeId = Convert.ToDecimal(cmbSalesMan.SelectedValue.ToString());
                    }
                    else
                    {
                        infoDeliveryNoteMaster.EmployeeId = 0;
                    }
                    infoDeliveryNoteMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;

                    if (cmbOrderNo.SelectedValue != null)
                    {
                        if (cmbDeliveryMode.Text == "Against Order")
                        {
                            infoDeliveryNoteMaster.OrderMasterId = Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString());
                            infoSalesOrderMaster = spSalesOrderMaster.SalesOrderMasterView(infoDeliveryNoteMaster.OrderMasterId);
                        }
                        else if (cmbDeliveryMode.Text == "Against Quotation")
                        {
                            infoDeliveryNoteMaster.QuotationMasterId = Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString());
                            infoSalesQuotationMaster = spSalesQuotationMaster.SalesQuotationMasterView(infoDeliveryNoteMaster.QuotationMasterId);
                        }
                        else if (cmbDeliveryMode.Text == "NA")
                        {
                            infoDeliveryNoteMaster.OrderMasterId = 0; infoDeliveryNoteMaster.QuotationMasterId = 0;
                        }
                    }
                    else
                    {
                        infoDeliveryNoteMaster.OrderMasterId = 0;
                        infoDeliveryNoteMaster.QuotationMasterId = 0;
                    }
                    infoDeliveryNoteMaster.Narration = txtNarration.Text.Trim();
                    infoDeliveryNoteMaster.ExchangeRateId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
                    infoDeliveryNoteMaster.TotalAmount = Convert.ToDecimal(txtTotalAmnt.Text);
                    infoDeliveryNoteMaster.TransportationCompany = txtTraspotationCompany.Text;
                    infoDeliveryNoteMaster.LrNo = txtLRNo.Text;
                    infoDeliveryNoteMaster.Extra1 = string.Empty;
                    infoDeliveryNoteMaster.Extra2 = string.Empty;
                    spDeliveryNoteMaster.DeliveryNoteMasterEdit(infoDeliveryNoteMaster);
                    RemoveDeliveryNoteDetails();
                    infoDeliveryNoteMaster.VoucherTypeId = decDeliveryNoteVoucherTypeId;
                    spDeliveryNoteMaster.StockPostDeletingForDeliveryNote(decDeliveryNoteVoucherTypeId, strVoucherNo, txtDeliveryNoteNo.Text);
                    DeliveryNoteDetails();
                    Messages.UpdatedMessage();
                    if (frmDeliveryNoteRegisterObj != null)
                    {
                        if (cbxPrint.Checked)
                        {
                            if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                            {
                                PrintForDotMatrix(decDelivryNoteIdToEdit);
                            }
                            else
                            {
                                Print(decDelivryNoteIdToEdit);
                            }
                        }
                        frmDeliveryNoteRegisterObj.GridFill();
                    }
                    if (frmDeliveryNoteReportObj != null)
                    {
                        if (cbxPrint.Checked)
                        {
                            if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                            {
                                PrintForDotMatrix(decDelivryNoteIdToEdit);
                            }
                            else
                            {
                                Print(decDelivryNoteIdToEdit);
                            }
                        }
                        frmDeliveryNoteReportObj.GridFill();
                    }
                    this.Close();
                }
                Clear();
            }
            catch (Exception ex)
            {
                MessageBox.Show("DN35:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// VoucherTypeComboFill
        /// </summary>
        public void VoucherTypeComboFill()
        {
            try
            {
                DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP();
                string typeOfVoucher = string.Empty;
                if (cmbDeliveryMode.Text == "Against Order")
                {
                    typeOfVoucher = "Sales Order";
                }
                else
                {
                    typeOfVoucher = "Sales Quotation";
                }
                DataTable dtbl = new DataTable();
                dtbl = spDeliveryNoteMaster.VoucherTypesBasedOnTypeOfVouchers(typeOfVoucher);

                cmbType.ValueMember = "voucherTypeId";
                cmbType.DisplayMember = "voucherTypeName";
                cmbType.DataSource = dtbl;
            }
            catch (Exception ex)
            {
                MessageBox.Show("DN34:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Save or edit function
        /// </summary>
        public void SaveOrEdit()
        {
            SettingsSP spSetting = new SettingsSP();
            try
            {
                decimal decIdentity = 0;
                DeliveryNoteMasterSP SpDeliveryNoteMaster = new DeliveryNoteMasterSP();
                DeliveryNoteMasterInfo InfoDeliveryNoteMaster = new DeliveryNoteMasterInfo();
                InfoDeliveryNoteMaster = SpDeliveryNoteMaster.DeliveryNoteMasterView(Convert.ToDecimal(cmbDeliveryNoteNo.SelectedValue));
                RejectionInMasterInfo InfoRejectionInMaster = new RejectionInMasterInfo();
                RejectionInDetailsInfo InfoRejectionInDetails = new RejectionInDetailsInfo();
                RejectionInDetailsSP SpRejectionInDetails = new RejectionInDetailsSP();
                StockPostingInfo InfoStockPosting = new StockPostingInfo();
                StockPostingSP SpStockPosting = new StockPostingSP();
                if (isAutomatic)
                {
                    InfoRejectionInMaster.VoucherNo = strVoucherNo;
                    InfoRejectionInMaster.InvoiceNo = txtRejectionInNo.Text;
                }
                else
                {
                    InfoRejectionInMaster.VoucherNo = txtRejectionInNo.Text;
                    InfoRejectionInMaster.InvoiceNo = txtRejectionInNo.Text;
                }
                InfoRejectionInMaster.VoucherTypeId = decRejectionInVoucherTypeId;
                InfoRejectionInMaster.SuffixPrefixId = decRejectionInSuffixPrefixId;
                InfoRejectionInMaster.Date = DateTime.Parse(txtDate.Text);
                InfoRejectionInMaster.LedgerId = Convert.ToDecimal(cmbCashorParty.SelectedValue.ToString());
                InfoRejectionInMaster.PricinglevelId = cmbPricingLevel.SelectedValue == null ? 0 : Convert.ToDecimal(cmbPricingLevel.SelectedValue.ToString());
                InfoRejectionInMaster.EmployeeId = cmbSalesMan.SelectedValue == null ? 1 : Convert.ToDecimal(cmbSalesMan.SelectedValue.ToString());
                InfoRejectionInMaster.Narration = txtNarration.Text.Trim();
                InfoRejectionInMaster.ExchangeRateId = cmbCurrency.SelectedValue == null ? 0 : Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
                InfoRejectionInMaster.TotalAmount = Convert.ToDecimal(txtTotalAmount.Text);
                InfoRejectionInMaster.UserId = PublicVariables._decCurrentUserId;
                InfoRejectionInMaster.LrNo = txtLRNo.Text.Trim();
                InfoRejectionInMaster.TransportationCompany = txtTransportationCompany.Text.Trim();
                InfoRejectionInMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
                InfoRejectionInMaster.Extra1 = string.Empty;
                InfoRejectionInMaster.Extra2 = string.Empty;
                InfoRejectionInMaster.DeliveryNoteMasterId = Convert.ToDecimal(cmbDeliveryNoteNo.SelectedValue == null ? "" : cmbDeliveryNoteNo.SelectedValue.ToString());

                if (decRejectionInIdToEdit == 0)
                {
                    decIdentity = spRejectionInMaster.RejectionInMasterAdd(InfoRejectionInMaster);
                }
                else
                {
                    InfoRejectionInMaster.RejectionInMasterId = decRejectionInIdToEdit;
                    spRejectionInMaster.RejectionInMasterEdit(InfoRejectionInMaster);
                }
                if (decRejectionInIdToEdit == 0)
                {
                    InfoRejectionInDetails.RejectionInMasterId = decIdentity;
                }
                else
                {
                    SpRejectionInDetails.DeleteRejectionInDetailsByRejectionInMasterId(decRejectionInIdToEdit);
                    SpStockPosting.DeleteStockPostingByAgnstVouTypeIdAndAgnstVouNo(decRejectionInVoucherTypeId, strVoucherNo);
                    InfoRejectionInDetails.RejectionInMasterId = decRejectionInIdToEdit;
                }
                foreach (DataGridViewRow dgvrow in dgvProduct.Rows)
                {
                    InfoRejectionInDetails.DeliveryNoteDetailsId = Convert.ToDecimal(dgvrow.Cells["dgvtxDeliveryNoteDetailsId"].Value.ToString());
                    InfoRejectionInDetails.ProductId = Convert.ToDecimal(dgvrow.Cells["dgvtxtProductId"].Value.ToString());
                    InfoRejectionInDetails.Qty = Convert.ToDecimal(dgvrow.Cells["dgvtxtQuantity"].Value.ToString());
                    InfoRejectionInDetails.Rate = Convert.ToDecimal(dgvrow.Cells["dgvtxtRate"].Value.ToString());
                    InfoRejectionInDetails.UnitId = Convert.ToDecimal(dgvrow.Cells["dgvcmbUnit"].Value.ToString());
                    InfoRejectionInDetails.UnitConversionId = Convert.ToDecimal(dgvrow.Cells["dgvtxtUnitConversionId"].Value.ToString());//0;//check
                    InfoRejectionInDetails.BatchId = Convert.ToDecimal(dgvrow.Cells["dgvcmbBatch"].Value.ToString());
                    InfoRejectionInDetails.GodownId = Convert.ToDecimal(dgvrow.Cells["dgvcmbGodown"].Value.ToString());
                    InfoRejectionInDetails.RackId = Convert.ToDecimal(dgvrow.Cells["dgvcmbRack"].Value.ToString());
                    InfoRejectionInDetails.Amount = Convert.ToDecimal(dgvrow.Cells["dgvtxtAmount"].Value.ToString());
                    InfoRejectionInDetails.SlNo = Convert.ToInt32(dgvrow.Cells["dgvtxtSlNo"].Value.ToString());
                    InfoRejectionInDetails.Extra1 = string.Empty;
                    InfoRejectionInDetails.Extra2 = string.Empty;
                    SpRejectionInDetails.RejectionInDetailsAdd(InfoRejectionInDetails);
                    InfoStockPosting.Date = Convert.ToDateTime(txtDate.Text);
                    InfoStockPosting.VoucherTypeId = InfoDeliveryNoteMaster.VoucherTypeId;
                    InfoStockPosting.VoucherNo = InfoDeliveryNoteMaster.VoucherNo;
                    InfoStockPosting.InvoiceNo = InfoDeliveryNoteMaster.InvoiceNo;
                    InfoStockPosting.ProductId = Convert.ToDecimal(dgvrow.Cells["dgvtxtProductId"].Value.ToString());
                    InfoStockPosting.BatchId = Convert.ToDecimal(dgvrow.Cells["dgvcmbBatch"].Value.ToString());
                    InfoStockPosting.UnitId = Convert.ToDecimal(dgvrow.Cells["dgvcmbUnit"].Value.ToString());
                    InfoStockPosting.GodownId = Convert.ToDecimal(dgvrow.Cells["dgvcmbGodown"].Value.ToString());
                    InfoStockPosting.RackId = Convert.ToDecimal(dgvrow.Cells["dgvcmbRack"].Value.ToString());
                    InfoStockPosting.AgainstVoucherTypeId = decRejectionInVoucherTypeId;
                    if (isAutomatic)
                    {
                        InfoStockPosting.AgainstInvoiceNo = txtRejectionInNo.Text;
                        InfoStockPosting.AgainstVoucherNo = strVoucherNo;
                    }
                    else
                    {
                        InfoStockPosting.AgainstInvoiceNo = txtRejectionInNo.Text;
                        InfoStockPosting.AgainstVoucherNo = txtRejectionInNo.Text;
                    }
                    InfoStockPosting.InwardQty = Convert.ToDecimal(dgvrow.Cells["dgvtxtQuantity"].Value.ToString());
                    InfoStockPosting.OutwardQty = 0;
                    InfoStockPosting.Rate = Convert.ToDecimal(dgvrow.Cells["dgvtxtRate"].Value.ToString());
                    InfoStockPosting.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
                    InfoStockPosting.Extra1 = string.Empty;
                    InfoStockPosting.Extra2 = string.Empty;
                    SpStockPosting.StockPostingAdd(InfoStockPosting);

                }
                if (decRejectionInIdToEdit == 0)
                {
                    Messages.SavedMessage();
                    if (cbxPrintAfterSave.Checked)
                    {
                        if (spSetting.SettingsStatusCheck("Printer") == "Dot Matrix")
                        {
                            PrintForDotMatrix(decIdentity);
                        }
                        else
                        {
                            Print(decIdentity);
                        }
                    }

                }
                else
                {
                    Messages.UpdatedMessage();
                    if (cbxPrintAfterSave.Checked)
                    {
                        if (spSetting.SettingsStatusCheck("Printer") == "Dot Matrix")
                        {
                            PrintForDotMatrix(decRejectionInIdToEdit);
                        }
                        else
                        {
                            Print(decRejectionInIdToEdit);
                        }
                    }
                    this.Close();

                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("RI:23" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Function to use the deliverynote no combofill
 /// </summary>
 /// <param name="decledgerid"></param>
 /// <param name="decVoucherTypeId"></param>
 public void DeliveryNoteNoCombofill()
 {
     try
     {
         isOrderFill = true;
         DeliveryNoteMasterSP spdeliverynotemaster = new DeliveryNoteMasterSP();
         decimal decledgerid = Convert.ToDecimal(cmbCashorParty.SelectedValue.ToString());
         decimal decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString());
         cmbDeliveryNoteNo.DataSource = spdeliverynotemaster.DeliveryNoteNoCorrespondingToLedger(decledgerid, decRejectionInIdToEdit, decVoucherTypeId);
         cmbDeliveryNoteNo.DisplayMember = "invoiceNo";
         cmbDeliveryNoteNo.ValueMember = "deliveryNoteMasterId";
         cmbDeliveryNoteNo.SelectedIndex = -1;
         isOrderFill = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("RI:07" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 14
0
        /// <summary>
        /// function to Rejection In updation
        /// </summary>
        public void RejectionInview()
        {
            decimal decRejectioInMasterId = 0;
            try
            {
                btnSave.Text = "Update";
                btnDelete.Enabled = true;
                isFromRejectionInRegister = true;
                RejectionInMasterSP SpRejectionInMaster = new RejectionInMasterSP();
                RejectionInMasterInfo InfoRejectionInMaster = new RejectionInMasterInfo();
                InfoRejectionInMaster = SpRejectionInMaster.RejectionInMasterView(decRejectionInIdToEdit);
                DeliveryNoteMasterSP SpDeliveryNoteMaster = new DeliveryNoteMasterSP();
                DeliveryNoteMasterInfo InfoDeliveryNoteMaster = new DeliveryNoteMasterInfo();
                InfoDeliveryNoteMaster = SpDeliveryNoteMaster.DeliveryNoteMasterView(InfoRejectionInMaster.DeliveryNoteMasterId);
                strRejectionInVoucherNo = SpRejectionInMaster.GetRejectionInVoucherNo(InfoRejectionInMaster.RejectionInMasterId);
                decRejectionInVoucherTypeId = InfoRejectionInMaster.VoucherTypeId;
                decRejectionInSuffixPrefixId = InfoRejectionInMaster.SuffixPrefixId;
                strVoucherNo = InfoRejectionInMaster.VoucherNo;
                VoucherTypeSP spVoucherType = new VoucherTypeSP();
                isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decRejectionInVoucherTypeId);

                if (!isAutomatic)
                {
                    txtRejectionInNo.ReadOnly = false;
                    txtRejectionInNo.Focus();
                }
                else
                {
                    txtRejectionInNo.ReadOnly = true;
                    txtDate.Focus();
                }
                txtRejectionInNo.Text = InfoRejectionInMaster.InvoiceNo;
                txtDate.Text = InfoRejectionInMaster.Date.ToString("dd-MMM-yyyy");
                dtpDate.Value = Convert.ToDateTime(txtDate.Text);
                cmbCashorParty.SelectedValue = InfoRejectionInMaster.LedgerId;
                cmbVoucherType.SelectedValue = InfoDeliveryNoteMaster.VoucherTypeId;
                cmbPricingLevel.SelectedValue = InfoRejectionInMaster.PricinglevelId;
                cmbDeliveryNoteNo.SelectedValue = InfoRejectionInMaster.DeliveryNoteMasterId;
                cmbSalesMan.SelectedValue = InfoRejectionInMaster.EmployeeId;
                cmbCurrency.SelectedValue = InfoRejectionInMaster.ExchangeRateId;
                txtTransportationCompany.Text = InfoRejectionInMaster.TransportationCompany;
                txtNarration.Text = InfoRejectionInMaster.Narration;
                txtLRNo.Text = InfoRejectionInMaster.LrNo;
                txtTotalAmount.Text = Convert.ToString(InfoRejectionInMaster.TotalAmount);
                RejectionInDetailsSP SpRejectionInDetails = new RejectionInDetailsSP();
                DataTable dtblRejectionInDetails = SpRejectionInDetails.RejectionInDetailsViewByRejectionInMasterId(decRejectionInIdToEdit);
                decRejectioInMasterId = Convert.ToDecimal(dtblRejectionInDetails.Rows[0]["voucherTypeId"].ToString());
                VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
                infoVoucherType = spVoucherType.VoucherTypeView(decRejectioInMasterId);
                this.Text = infoVoucherType.VoucherTypeName;
                foreach (DataRow drRejectionInDetails in dtblRejectionInDetails.Rows)
                {
                    isDoCellValueChange = false;
                    DGVGodownComboFill();
                    dgvProduct.Rows.Add();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvtxtProductId"].Value = drRejectionInDetails["productId"].ToString();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvtxDeliveryNoteDetailsId"].Value = drRejectionInDetails.ItemArray[2].ToString();
                    AssignProductDefaultValues(dgvProduct.Rows.Count - 1, Convert.ToDecimal(drRejectionInDetails.ItemArray[3].ToString()));
                    DGVBatchComboFill(dgvProduct.Rows.Count - 1, Convert.ToDecimal(drRejectionInDetails.ItemArray[3].ToString()));
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvtxtQuantity"].Value = drRejectionInDetails["qty"].ToString();
                    isDoCellValueChange = true;
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(drRejectionInDetails["unitId"].ToString());
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drRejectionInDetails["unitconversionId"].ToString());
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(drRejectionInDetails["godownId"].ToString());
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvcmbRack"].Value = Convert.ToDecimal(drRejectionInDetails["rackId"].ToString());
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(drRejectionInDetails["batchId"].ToString());
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvtxtRate"].Value = drRejectionInDetails["rate"].ToString();
                    dgvProduct.Rows[dgvProduct.Rows.Count - 1].Cells["dgvtxtAmount"].Value = drRejectionInDetails["amount"].ToString();
                    dgvProduct.CurrentCell = null;
                }
                SerialNo();
                CalcTotalAmt();
                isDoCellValueChange = true;
                isDoAfterGridFill = true;
                isFromRejectionInRegister = false;
               
            }
            catch (Exception ex)
            {
                MessageBox.Show("RI:35" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);              
            }
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Edit Function
 /// </summary>
 public void EditFunction()
 {
     try
     {
         removeSalesInvoiceDetails();
         SalesMasterSP spSalesMaster = new SalesMasterSP();
         SalesMasterInfo InfoSalesMaster = new SalesMasterInfo();
         InfoSalesMaster = spSalesMaster.SalesMasterView(decSalesInvoiceIdToEdit);
         if (InfoSalesMaster.DeliveryNoteMasterId != 0)
         {
             DeliveryNoteMasterInfo infoDeliveryNote = new DeliveryNoteMasterInfo();
             infoDeliveryNote = new DeliveryNoteMasterSP().DeliveryNoteMasterView(InfoSalesMaster.DeliveryNoteMasterId);
             new StockPostingSP().StockPostingDeleteForSalesInvoiceAgainstDeliveryNote
                 (InfoSalesMaster.VoucherTypeId, InfoSalesMaster.VoucherNo,
                 infoDeliveryNote.VoucherNo, infoDeliveryNote.VoucherTypeId);
         }
         new StockPostingSP().StockPostingDeleteByagainstVoucherTypeIdAndagainstVoucherNoAndVoucherNoAndVoucherType
                 (0, "NA", InfoSalesMaster.VoucherNo, InfoSalesMaster.VoucherTypeId);
         InfoSalesMaster.SalesMasterId = decSalesInvoiceIdToEdit;
         InfoSalesMaster.AdditionalCost = Convert.ToDecimal(lblLedgerTotalAmount.Text);
         InfoSalesMaster.BillDiscount = Convert.ToDecimal(txtBillDiscount.Text.Trim());
         InfoSalesMaster.CreditPeriod = Convert.ToInt32(txtCreditPeriod.Text.Trim().ToString());
         InfoSalesMaster.CustomerName = txtCustomer.Text.Trim();
         InfoSalesMaster.Date = Convert.ToDateTime(txtDate.Text.ToString());
         InfoSalesMaster.ExchangeRateId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         InfoSalesMaster.EmployeeId = Convert.ToDecimal(cmbSalesMan.SelectedValue.ToString());
         InfoSalesMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
         InfoSalesMaster.GrandTotal = Convert.ToDecimal(txtGrandTotal.Text.Trim());
         InfoSalesMaster.InvoiceNo = txtInvoiceNo.Text.Trim();
         InfoSalesMaster.LedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString());
         InfoSalesMaster.VoucherTypeId = DecSalesInvoiceVoucherTypeId;
         InfoSalesMaster.VoucherNo = strVoucherNo;
         if (isAutomatic)
         {
             InfoSalesMaster.SuffixPrefixId = decSalseInvoiceSuffixPrefixId;
         }
         else
         {
             InfoSalesMaster.SuffixPrefixId = 0;
         }
         if (cmbSalesMode.Text == "Against SalesOrder")
         {
             InfoSalesMaster.OrderMasterId = Convert.ToDecimal(cmbSalesModeOrderNo.SelectedValue.ToString());
         }
         else
         {
             InfoSalesMaster.OrderMasterId = 0;
         }
         if (cmbSalesMode.Text == "Against Delivery Note")
         {
             InfoSalesMaster.DeliveryNoteMasterId = Convert.ToDecimal(cmbSalesModeOrderNo.SelectedValue.ToString());
         }
         else
         {
             InfoSalesMaster.DeliveryNoteMasterId = 0;
         }
         if (cmbSalesMode.Text == "Against Quotation")
         {
             InfoSalesMaster.QuotationMasterId = Convert.ToDecimal(cmbSalesModeOrderNo.SelectedValue.ToString());
         }
         else
         {
             InfoSalesMaster.QuotationMasterId = 0;
         }
         InfoSalesMaster.Narration = txtNarration.Text.Trim();
         InfoSalesMaster.PricinglevelId = Convert.ToDecimal(cmbPricingLevel.SelectedValue.ToString());
         InfoSalesMaster.SalesAccount = Convert.ToDecimal(cmbSalesAccount.SelectedValue.ToString());
         InfoSalesMaster.TotalAmount = Convert.ToDecimal(txtTotalAmount.Text.Trim());
         if (dgvSalesInvoice.Columns["dgvcmbSalesInvoiceTaxName"].Visible)
         {
             InfoSalesMaster.TaxAmount = Convert.ToDecimal(lblTaxTotalAmount.Text.Trim());
         }
         else
         {
             InfoSalesMaster.TaxAmount = 0;
         }
         InfoSalesMaster.UserId = PublicVariables._decCurrentUserId;
         InfoSalesMaster.LrNo = txtVehicleNo.Text;
         InfoSalesMaster.TransportationCompany = txtTransportCompany.Text.Trim();
         InfoSalesMaster.POS = false;
         InfoSalesMaster.CounterId = 0;
         InfoSalesMaster.ExtraDate = DateTime.Now;
         InfoSalesMaster.Extra1 = string.Empty;
         InfoSalesMaster.Extra2 = string.Empty;
         spSalesMaster.SalesMasterEdit(InfoSalesMaster);
         removeSalesInvoiceDetails();
         SalesInvoiceDetailsEditFill();
         if (cmbCashOrParty.Enabled)
         {
             LedgerPostingSP spLedgerPosting = new LedgerPostingSP();
             spLedgerPosting.LedgerPostDelete(strVoucherNo, DecSalesInvoiceVoucherTypeId);
             ledgerPostingAdd();
         }
         else
         {
             ledgerPostingEdit();
         }
         Messages.UpdatedMessage();
         if (cbxPrintAfterSave.Checked)
         {
             SettingsSP spSettings = new SettingsSP();
             if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
             {
                 PrintForDotMatrix(decSalesInvoiceIdToEdit);
             }
             else
             {
                 Print(decSalesInvoiceIdToEdit);
             }
         }
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show("SI: 78" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Against Sales order combofill function
 /// </summary>
 public void againstOrderComboFill()
 {
     try
     {
         SalesOrderMasterSP spSalesOrderMaster = new SalesOrderMasterSP();
         DeliveryNoteMasterSP spDeliveryNoteMasterSp = new DeliveryNoteMasterSP();
         SalesQuotationMasterSP spSalesQuotationMasterSp = new SalesQuotationMasterSP();
         DataTable dtbl = new DataTable();
         if (cmbCashOrParty.SelectedValue != null)
         {
             if (cmbSalesMode.Text == "Against SalesOrder")
             {
                 dtbl = spSalesOrderMaster.GetSalesOrderNoIncludePendingCorrespondingtoLedgerforSI(Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()), decSalesInvoiceIdToEdit, Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()));
                 DataRow dr = dtbl.NewRow();
                 dr["invoiceNo"] = "";
                 dr["salesOrderMasterId"] = 0;
                 dtbl.Rows.InsertAt(dr, 0);
                 isFromEditMode = true;
                 cmbSalesModeOrderNo.DataSource = dtbl;
                 cmbSalesModeOrderNo.ValueMember = "salesOrderMasterId";
                 cmbSalesModeOrderNo.DisplayMember = "invoiceNo";
                 isFromEditMode = false;
             }
             if (cmbSalesMode.Text == "Against Delivery Note")
             {
                 dtbl = spDeliveryNoteMasterSp.GetDeleveryNoteNoIncludePendingCorrespondingtoLedgerForSI(Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()), decSalesInvoiceIdToEdit, Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()));
                 DataRow dr = dtbl.NewRow();
                 dr["invoiceNo"] = "";
                 dr["deliveryNoteMasterId"] = 0;
                 dtbl.Rows.InsertAt(dr, 0);
                 isFromEditMode = true;
                 cmbSalesModeOrderNo.DataSource = dtbl;
                 cmbSalesModeOrderNo.ValueMember = "deliveryNoteMasterId";
                 cmbSalesModeOrderNo.DisplayMember = "invoiceNo";
                 isFromEditMode = false;
             }
             if (cmbSalesMode.Text == "Against Quotation")
             {
                 dtbl = spSalesQuotationMasterSp.GetSalesQuotationIncludePendingCorrespondingtoLedgerForSI(Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()), decSalesInvoiceIdToEdit, Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()));
                 DataRow dr = dtbl.NewRow();
                 dr["invoiceNo"] = "";
                 dr["quotationMasterId"] = 0;
                 dtbl.Rows.InsertAt(dr, 0);
                 isFromEditMode = true;
                 cmbSalesModeOrderNo.DataSource = dtbl;
                 cmbSalesModeOrderNo.ValueMember = "quotationMasterId";
                 cmbSalesModeOrderNo.DisplayMember = "invoiceNo";
                 isFromEditMode = false;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SI: 13" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Function to Print
 /// </summary>
 /// <param name="decDeliveryNoteMasterId"></param>
 public void Print(decimal decDeliveryNoteMasterId)
 {
     try
     {
         DeliveryNoteMasterInfo infoDeliveryNoteMaster = new DeliveryNoteMasterInfo();
         DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP();
         DataSet dsDeliveryNote = spDeliveryNoteMaster.DeliveryNotePrinting(decDeliveryNoteMasterId, 1, infoDeliveryNoteMaster.OrderMasterId, infoDeliveryNoteMaster.QuotationMasterId);
         frmReport frmReport = new frmReport();
         frmReport.MdiParent = formMDI.MDIObj;
         frmReport.DeliveryNotePrinting(dsDeliveryNote);
     }
     catch (Exception ex)
     {
         MessageBox.Show("DN40:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }