Пример #1
0
 /// <summary>
 /// Delete function
 /// </summary>
 public void Delete()
 {
     StockPostingSP spStockPosting = new StockPostingSP();
     PurchaseOrderDetailsSP spPurchaseOrderDetails = new PurchaseOrderDetailsSP();
     PurchaseOrderMasterSP spPurchaseOrderMaster = new PurchaseOrderMasterSP();
     try
     {
         decimal decResult1 = 0;
         for (int inI = 0; inI < dgvPurchaseOrder.Rows.Count - 1; inI++)
         {
             if (Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtPurchaseOrderDetailsId"].Value) != 0)
             {
                 decResult1 = spPurchaseOrderDetails.PurchaseOrderDetailsDelete(Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtPurchaseOrderDetailsId"].Value));
             }
         }
         decimal decResult2 = spPurchaseOrderMaster.PurchaseOrderMasterDelete(decPurchaseOrderMasterId);
         if (decResult1 > 0 && decResult2 > 0)
         {
             Messages.DeletedMessage();
             if (frmPurchaseOrderRegisterObj != null)
             {
                 this.Close();
                 frmPurchaseOrderRegisterObj.GridFill();
             }
             if (frmPurchaseOrderReportObj != null)
             {
                 this.Close();
                 frmPurchaseOrderReportObj.GridFill();
             }
             if (objVoucherSearch != null)
             {
                 this.Close();
                 objVoucherSearch.GridFill();
             }
             if (frmDayBookObj != null)
             {
                 this.Close();
             }
         }
         else
         {
             Messages.ReferenceExistsMessage();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PO16:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #2
0
 /// <summary>
 /// Fill function to updation
 /// </summary>
 /// <param name="isPending"></param>
 public void FillRegisterOrReport(bool isPending)
 {
     try
     {
         PurchaseOrderMasterInfo infoPurchaseOrderMaster = new PurchaseOrderMasterInfo();
         PurchaseOrderMasterSP spPurchaseOrderMaster = new PurchaseOrderMasterSP();
         VoucherTypeSP spVoucherType = new VoucherTypeSP();
         PurchaseOrderDetailsSP spPurchaseOrderDetails = new PurchaseOrderDetailsSP();
         btnSave.Text = "Update";
         btnDelete.Enabled = true;
         txtOrderNo.ReadOnly = true;
         infoPurchaseOrderMaster = spPurchaseOrderMaster.PurchaseOrderMasterView(decPurchaseOrderMasterId);
         txtOrderNo.Text = infoPurchaseOrderMaster.InvoiceNo;
         strVoucherNo = infoPurchaseOrderMaster.VoucherNo.ToString();
         decPurchaseSuffixPrefixId = Convert.ToDecimal(infoPurchaseOrderMaster.SuffixPrefixId);
         decPurchaseVoucherId = Convert.ToDecimal(infoPurchaseOrderMaster.VoucherTypeId);
         isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decPurchaseVoucherId);
         decPurchaseOrderTypeId = decPurchaseVoucherId;
         txtDate.Text = infoPurchaseOrderMaster.Date.ToString("dd-MMM-yyyy");
         cmbCashOrParty.SelectedValue = infoPurchaseOrderMaster.LedgerId;
         txtDueDate.Text = infoPurchaseOrderMaster.DueDate.ToString("dd-MMM-yyyy");
         TimeSpan objTs = Convert.ToDateTime(txtDueDate.Text).Subtract(Convert.ToDateTime(txtDate.Text));
         txtDueDays.Text = objTs.Days.ToString();
         txtNarration.Text = infoPurchaseOrderMaster.Narration;
         cmbCurrency.SelectedValue = infoPurchaseOrderMaster.exchangeRateId;
         txtTotalAmount.Text = infoPurchaseOrderMaster.TotalAmount.ToString();
         DataTable dtbl = new DataTable();
         if (isPending)
         {
             dtbl = spPurchaseOrderDetails.PurchaseOrderDetailsViewWithRemaining(decPurchaseOrderMasterId);
         }
         else
         {
             dtbl = spPurchaseOrderDetails.PurchaseOrderDetailsViewByMasterId(decPurchaseOrderMasterId);
         }
         if (CheckCancelStatus(decPurchaseOrderMasterId))
         {
             isCheck = true;
             cbxCancel.Checked = true;
             cbxCancel.Enabled = false;
             isCheck = false;
         }
         else
         {
             isCheck = true;
             cbxCancel.Enabled = true;
             //  cbxCancel.Checked = false;
             isCheck = false;
         }
         dgvPurchaseOrder.Rows.Clear();
         for (int i = 0; i < dtbl.Rows.Count; i++)
         {
             isAmountcalc = false;
             dgvPurchaseOrder.Rows.Add();
             dgvPurchaseOrder.Rows[i].HeaderCell.Value = string.Empty;
             dgvPurchaseOrder.Rows[i].Cells["dgvtxtPurchaseOrderDetailsId"].Value = Convert.ToDecimal(dtbl.Rows[i]["purchaseOrderDetailsId"].ToString());
             decPurchaseOrderDetailId = Convert.ToDecimal(dtbl.Rows[i]["purchaseOrderDetailsId"].ToString());
             //dgvPurchaseOrder.Rows[i].Cells["dgvtxtSlNo"].Value = dtbl.Rows[i]["slNo"].ToString();
             dgvPurchaseOrder.Rows[i].Cells["dgvtxtProductId"].Value = dtbl.Rows[i]["productId"].ToString();
             dgvPurchaseOrder.Rows[i].Cells["dgvtxtProductCode"].Value = dtbl.Rows[i]["productCode"].ToString();
             dgvPurchaseOrder.Rows[i].Cells["dgvtxtProductName"].Value = dtbl.Rows[i]["productName"].ToString();
             dgvPurchaseOrder.Rows[i].Cells["dgvtxtQty"].Value = dtbl.Rows[i]["qty"].ToString();
             UnitComboFill(Convert.ToDecimal(dtbl.Rows[i]["productId"].ToString()), i, dgvPurchaseOrder.Rows[i].Cells["dgvcmbUnit"].ColumnIndex);
             dgvPurchaseOrder.Rows[i].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(dtbl.Rows[i]["unitId"].ToString());
             dgvPurchaseOrder.Rows[i].Cells["dgvtxtUnitConversionId"].Value = dtbl.Rows[i]["unitConversionId"].ToString();
             dgvPurchaseOrder.Rows[i].Cells["dgvtxtUnitConversionRate"].Value = dtbl.Rows[i]["conversionRate"].ToString();
             dgvPurchaseOrder.Rows[i].Cells["dgvtxtRate"].Value = dtbl.Rows[i]["rate"].ToString();
             dgvPurchaseOrder.Rows[i].Cells["dgvtxtAmount"].Value = dtbl.Rows[i]["amount"].ToString();
             dgvPurchaseOrder.Rows[i].Cells["dgvtxtProductName"].ReadOnly = true;
             dgvPurchaseOrder.Rows[i].Cells["dgvtxtProductCode"].ReadOnly = true;
             dgvPurchaseOrder.Rows[i].Cells["dgvtxtBarcode"].ReadOnly = true;
         }
         SerialNo();
         isAmountcalc = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PO25:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #3
0
 /// <summary>
 /// Remove Product and details in editing mode
 /// </summary>
 public void RemovePurchaseOrderDetails()
 {
     try
     {
         PurchaseOrderDetailsSP spPurchaseOrderDetails = new PurchaseOrderDetailsSP();
         foreach (var strId in lstArrOfRemove)
         {
             decimal decDeleteId = Convert.ToDecimal(strId);
             spPurchaseOrderDetails.PurchaseOrderDetailsDelete(decDeleteId);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PO9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #4
0
 /// <summary>
 /// Save Function
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         PurchaseOrderMasterInfo infoPurchaseOrderMaster = new PurchaseOrderMasterInfo();
         PurchaseOrderDetailsSP spPurchaseOrderDetails = new PurchaseOrderDetailsSP();
         PurchaseOrderDetailsInfo infoPurchaseOrderDetails = new PurchaseOrderDetailsInfo();
         PurchaseOrderMasterSP spPurchaseOrderMaster = new PurchaseOrderMasterSP();
         ProductInfo infoProduct = new ProductInfo();
         ProductSP spProduct = new ProductSP();
         SettingsSP spSettings = new SettingsSP();
         if (cbxCancel.Checked)
         {
             infoPurchaseOrderMaster.Cancelled = true;
         }
         else
         {
             infoPurchaseOrderMaster.Cancelled = false;
         }
         infoPurchaseOrderMaster.Date = Convert.ToDateTime(txtDate.Text);
         infoPurchaseOrderMaster.DueDate = Convert.ToDateTime(txtDueDate.Text);
         infoPurchaseOrderMaster.LedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString());
         if (isAutomatic == true)
         {
             infoPurchaseOrderMaster.SuffixPrefixId = decPurchaseSuffixPrefixId;
             infoPurchaseOrderMaster.VoucherNo = strVoucherNo;
         }
         else
         {
             infoPurchaseOrderMaster.SuffixPrefixId = 0;
             infoPurchaseOrderMaster.VoucherNo = spPurchaseOrderMaster.VoucherNoMax(decPurchaseOrderTypeId);
         }
         infoPurchaseOrderMaster.VoucherTypeId = decPurchaseOrderTypeId;
         infoPurchaseOrderMaster.InvoiceNo = txtOrderNo.Text;
         infoPurchaseOrderMaster.UserId = PublicVariables._decCurrentUserId;
         infoPurchaseOrderMaster.EmployeeId = PublicVariables._decCurrentUserId;//by default current userid used as current employeeid
         infoPurchaseOrderMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
         infoPurchaseOrderMaster.Narration = txtNarration.Text.Trim();
         infoPurchaseOrderMaster.TotalAmount = Convert.ToDecimal(txtTotalAmount.Text);
         infoPurchaseOrderMaster.exchangeRateId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoPurchaseOrderMaster.Extra1 = string.Empty;
         infoPurchaseOrderMaster.Extra2 = string.Empty;
         decPurchaseOrderMasterIdentity = Convert.ToDecimal(spPurchaseOrderMaster.PurchaseOrderMasterAdd(infoPurchaseOrderMaster));
         int inRowcount = dgvPurchaseOrder.Rows.Count;
         for (int inI = 0; inI < inRowcount - 1; inI++)
         {
             infoPurchaseOrderDetails.PurchaseOrderMasterId = decPurchaseOrderMasterIdentity;
             if (dgvPurchaseOrder.Rows[inI].Cells["dgvtxtProductCode"].Value != null && dgvPurchaseOrder.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString() != "")
             {
                 infoProduct = spProduct.ProductViewByCode(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString());
                 infoPurchaseOrderDetails.ProductId = infoProduct.ProductId;
             }
             if (dgvPurchaseOrder.Rows[inI].Cells["dgvtxtQty"].Value != null && dgvPurchaseOrder.Rows[inI].Cells["dgvtxtQty"].Value.ToString() != "")
             {
                 infoPurchaseOrderDetails.Qty = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtQty"].Value.ToString());
             }
             if (dgvPurchaseOrder.Rows[inI].Cells["dgvcmbUnit"].Value != null && dgvPurchaseOrder.Rows[inI].Cells["dgvcmbUnit"].Value.ToString() != "")
             {
                 infoPurchaseOrderDetails.UnitId = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvcmbUnit"].Value);
                 infoPurchaseOrderDetails.UnitConversionId = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtUnitConversionId"].Value.ToString());
             }
             infoPurchaseOrderDetails.Rate = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtRate"].Value.ToString());
             infoPurchaseOrderDetails.Amount = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtAmount"].Value.ToString());
             infoPurchaseOrderDetails.SlNo = Convert.ToInt32(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtSlNo"].Value.ToString());
             infoPurchaseOrderDetails.Extra1 = string.Empty;
             infoPurchaseOrderDetails.Extra2 = string.Empty;
             spPurchaseOrderDetails.PurchaseOrderDetailsAdd(infoPurchaseOrderDetails);
         }
         Messages.SavedMessage();
         if (cbxPrintAfterSave.Checked)
         {
             if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
             {
                 PrintForDotMatrix(decPurchaseOrderMasterIdentity);
             }
             else
             {
                 Print(decPurchaseOrderMasterIdentity);
             }
         }
         Clear();
     }
     catch (Exception ex)
     {
         MessageBox.Show("PO35:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #5
0
 /// <summary>
 /// edit function for PurchaseOrderDetails
 /// </summary>
 public void EditPurchaseOrderDetails()
 {
     try
     {
         ProductInfo infoProduct = new ProductInfo();
         ProductSP spProduct = new ProductSP();
         PurchaseOrderDetailsInfo infoPurchaseOrderDetails = new PurchaseOrderDetailsInfo();
         PurchaseOrderDetailsSP spPurchaseOrderDetails = new PurchaseOrderDetailsSP();
         for (int inI = 0; inI < dgvPurchaseOrder.Rows.Count - 1; inI++)
         {
             if (Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtPurchaseOrderDetailsId"].Value) == 0 || dgvPurchaseOrder.Rows[inI].Cells["dgvtxtPurchaseOrderDetailsId"].Value.ToString() == null || dgvPurchaseOrder.Rows[inI].Cells["dgvtxtPurchaseOrderDetailsId"].Value.ToString() == string.Empty)
             {
                 infoPurchaseOrderDetails.PurchaseOrderMasterId = decPurchaseOrderMasterId;
                 infoProduct = spProduct.ProductViewByCode(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString());
                 infoPurchaseOrderDetails.ProductId = infoProduct.ProductId;
                 infoPurchaseOrderDetails.Qty = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtQty"].Value.ToString());
                 infoPurchaseOrderDetails.UnitId = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvcmbUnit"].Value);
                 infoPurchaseOrderDetails.UnitConversionId = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtUnitConversionId"].Value);
                 infoPurchaseOrderDetails.Rate = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtRate"].Value.ToString());
                 infoPurchaseOrderDetails.Amount = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtAmount"].Value.ToString());
                 infoPurchaseOrderDetails.SlNo = Convert.ToInt32(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtSlNo"].Value.ToString());
                 infoPurchaseOrderDetails.Extra1 = string.Empty;
                 infoPurchaseOrderDetails.Extra2 = string.Empty;
                 spPurchaseOrderDetails.PurchaseOrderDetailsAdd(infoPurchaseOrderDetails);
             }
             else
             {
                 infoPurchaseOrderDetails.PurchaseOrderMasterId = decPurchaseOrderMasterId;
                 infoPurchaseOrderDetails.PurchaseOrderDetailsId = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtPurchaseOrderDetailsId"].Value);
                 infoProduct = spProduct.ProductViewByCode(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString());
                 infoPurchaseOrderDetails.ProductId = infoProduct.ProductId;
                 infoPurchaseOrderDetails.Qty = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtQty"].Value.ToString());
                 infoPurchaseOrderDetails.UnitId = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvcmbUnit"].Value.ToString());
                 infoPurchaseOrderDetails.UnitConversionId = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtUnitConversionId"].Value);
                 infoPurchaseOrderDetails.Rate = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtRate"].Value.ToString());
                 infoPurchaseOrderDetails.Amount = Convert.ToDecimal(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtAmount"].Value.ToString());
                 infoPurchaseOrderDetails.SlNo = Convert.ToInt32(dgvPurchaseOrder.Rows[inI].Cells["dgvtxtSlNo"].Value.ToString());
                 infoPurchaseOrderDetails.Extra1 = string.Empty;
                 infoPurchaseOrderDetails.Extra2 = string.Empty;
                 spPurchaseOrderDetails.PurchaseOrderDetailsEdit(infoPurchaseOrderDetails);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PO33:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #6
0
 /// <summary>
 /// Function to fill the details against purchase order
 /// </summary>
 public void FillOrderDetails()
 {
     BatchSP spbatch = new BatchSP();
     PurchaseOrderDetailsSP SPPurchaseOrderDetails = new PurchaseOrderDetailsSP();
     StockPostingSP spStockPosting = new StockPostingSP();
     ProductSP spproduct = new ProductSP();
     try
     {
         if (!isEditFill)
         {
             isValueChange = false;
             if (dgvProduct.RowCount > 1)
             {
                 for (int i = 0; i < dgvProduct.RowCount - 1; i++)
                 {
                     if (dgvProduct.Rows[i].Cells["dgvtxtMaterialReceiptdetailsId"].Value != null && dgvProduct.Rows[i].Cells["dgvtxtMaterialReceiptdetailsId"].Value.ToString() != string.Empty)
                     {
                         lstArrOfRemove.Add(dgvProduct.Rows[i].Cells["dgvtxtMaterialReceiptdetailsId"].Value.ToString());
                     }
                 }
             }
             dgvProduct.Rows.Clear();
             isValueChange = true;
             isDoAfterGridFill = false;
             DataTable dtblDetails = new DataTable();
             if (Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()) == decOrderNoWhileEditMode && btnSave.Text == "Update")
             {
                 dtblDetails = SPPurchaseOrderDetails.PurchaseOrderDetailsViewByOrderMasterIdWithRemainingForEdit(Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()), decMaterialReceiptId);
             }
             else
             {
                 dtblDetails = SPPurchaseOrderDetails.PurchaseOrderDetailsViewByOrderMasterIdWithRemaining(Convert.ToDecimal(cmbOrderNo.SelectedValue.ToString()), decMaterialReceiptId);
             }
             int inRowIndex = 0;
             foreach (DataRow drowDetails in dtblDetails.Rows)
             {
                 dgvProduct.Rows.Add();
                 isValueChange = false;
                 isDoAfterGridFill = false;
                 dgvProduct.CurrentCell = dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"];
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtPurchaseOrderDetailsId"].Value = Convert.ToString(drowDetails.ItemArray[0]);
                 strproductId = drowDetails.ItemArray[2].ToString();
                 ProductInfo infoproduct = new ProductInfo();
                 infoproduct = spproduct.ProductView(Convert.ToDecimal(strproductId));
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["productId"].Value = Convert.ToDecimal(strproductId);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductCode"].Value = infoproduct.ProductCode;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"].Value = infoproduct.ProductName;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtvouchertypeId"].Value = Convert.ToString(drowDetails.ItemArray[11]);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtvoucherNo"].Value = Convert.ToString(drowDetails.ItemArray[12]);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtinvoiceNo"].Value = Convert.ToString(drowDetails.ItemArray[13]);
                 UnitComboFill(Convert.ToDecimal(strproductId), dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ColumnIndex);
                 isValueChange = true;
                 isDoAfterGridFill = true;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(drowDetails["unitId"].ToString());
                 UnitConvertionSP SpUnitConvertion = new UnitConvertionSP();
                 DataTable dtblUnitByProduct = new DataTable();
                 dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(strproductId);
                 foreach (DataRow drUnitByProduct in dtblUnitByProduct.Rows)
                 {
                     if (dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString())
                     {
                         dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString());
                         dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString());
                     }
                 }
                 isValueChange = false;
                 isDoAfterGridFill = false;
                 BatchComboFill(Convert.ToDecimal(strproductId), dgvProduct.Rows.Count - 2, Convert.ToInt32(dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].ColumnIndex));
                 decimal decBatch = spStockPosting.BatchViewByProductId(Convert.ToDecimal(strproductId));
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].Value = decBatch;
                 string strBarcode = spbatch.ProductBatchBarcodeViewByBatchId(decBatch);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].Value = strBarcode;
                 DGVGodownComboFill();
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(1);
                 RackComboFill(1, dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvCmbRack"].ColumnIndex);
                 DataTable dtbl = new DataTable();
                 RackSP spRack = new RackSP();
                 dtbl = spRack.RackNamesCorrespondingToGodownId(1);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvCmbRack"].Value = Convert.ToDecimal(dtbl.Rows[0]["rackId"].ToString());
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtQty"].Value = Convert.ToString(drowDetails.ItemArray[3]);
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtRate"].Value = Convert.ToString(drowDetails.ItemArray[4]);
                 decCurrentRate = Convert.ToDecimal(drowDetails.ItemArray[4].ToString());
                 decCurrentConversionRate = Convert.ToDecimal(dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtConversionRate"].Value.ToString());
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtAmount"].Value = Convert.ToString(drowDetails.ItemArray[6]);
                 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["dgvtxtBarcode"].ReadOnly = true;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtAmount"].ReadOnly = true;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["inRowIndex"].Value = Convert.ToString(drowDetails["extra1"]);
                 if (cmbVoucherType.Text != "NA")
                 {
                     dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ReadOnly = true;
                 }
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].HeaderCell.Value = string.Empty;
                 int intIndex = 0;
                 int.TryParse(Convert.ToString(drowDetails["extra1"]), out intIndex);
                 if (inMaxCount < intIndex)
                     inMaxCount = intIndex;
                 inRowIndex++;
                 NewAmountCalculation(string.Empty, dgvProduct.Rows.Count - 2);
                 isValueChange = true;
                 isDoAfterGridFill = true;
                 dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ReadOnly = true;
             }
             for (int i = inRowIndex; i < dgvProduct.Rows.Count; ++i)
                 dgvProduct["inRowIndex", i].Value = Convert.ToString(GetNextinRowIndex());
             SerialNo();
             CalculateTotalAmount();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MR39:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #7
0
        /// <summary>
        /// Function to fill the Vouchertype combobox
        /// </summary>
        public void VoucherTypeCombofill()
        {

            PurchaseOrderDetailsSP SPPurchaseOrderDetails = new PurchaseOrderDetailsSP();
            try
            {
                isDontExecuteVoucherType = true;
                dtbl = SPPurchaseOrderDetails.VoucherTypeCombofillforPurchaseOrderReport();
                cmbVoucherType.DataSource = dtbl;
                cmbVoucherType.ValueMember = "voucherTypeId";
                cmbVoucherType.DisplayMember = "voucherTypeName";
                cmbVoucherType.SelectedIndex = 0;
                isDontExecuteVoucherType = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("MR23:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }