示例#1
0
        /// <summary>
        /// Function to Edit stockposting table
        /// </summary>
        public void StockPostingTableEditFill()
        {

            try
            {
                StockPostingSP spStockPosting = new StockPostingSP();
                StockPostingInfo infoStockPosting = new StockPostingInfo();
                BatchSP spBatch = new BatchSP();
                for (int inI = 0; inI < dgvProductCreation.RowCount - 1; inI++)
                {
                    infoStockPosting.StockPostingId = Convert.ToDecimal(dgvProductCreation.Rows[inI].Cells["dgvtxtstockpostId"].Value);
                    infoStockPosting.AgainstInvoiceNo = string.Empty;
                    infoStockPosting.AgainstVoucherNo = string.Empty;
                    infoStockPosting.Date = PublicVariables._dtCurrentDate;
                    infoStockPosting.AgainstVoucherTypeId = 0;
                    infoStockPosting.InvoiceNo = Convert.ToString(decProductIdForEdit);
                    infoStockPosting.VoucherNo = Convert.ToString(decProductIdForEdit);
                    infoStockPosting.VoucherTypeId = 2;

                    infoStockPosting.UnitId = Convert.ToDecimal(dgvProductCreation.Rows[inI].Cells["dgvcmbUnit"].Value);
                    infoStockPosting.InwardQty = Convert.ToDecimal(dgvProductCreation.Rows[inI].Cells["dgvtxtqty"].Value);
                    infoStockPosting.OutwardQty = 0;
                    infoStockPosting.ProductId = decProductIdForEdit;

                    infoStockPosting.Rate = Convert.ToDecimal(dgvProductCreation.Rows[inI].Cells["dgvtxtrate"].Value);
                    infoStockPosting.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
                    infoStockPosting.Extra1 = string.Empty;
                    infoStockPosting.Extra2 = string.Empty;
                    infoStockPosting.ExtraDate = DateTime.Now;
                    if (!dgvProductCreation.Columns["dgvcmbrack"].Visible)
                    {
                        infoStockPosting.RackId = 1;
                    }
                    else
                    {
                        infoStockPosting.RackId = Convert.ToDecimal(dgvProductCreation.Rows[inI].Cells["dgvcmbrack"].Value);
                    }

                    if (!dgvProductCreation.Columns["dgvcmbtgodown"].Visible)
                    {
                        infoStockPosting.GodownId = 1;
                    }
                    else
                    {
                        infoStockPosting.GodownId = Convert.ToDecimal(dgvProductCreation.Rows[inI].Cells["dgvcmbtgodown"].Value);
                    }

                    if (cmbAllowBatch.SelectedIndex == 0)
                    {
                        if (isBatchRemoved)
                        {
                            infoStockPosting.BatchId = spBatch.BatchIdForStockPosting(decProductIdForEdit);
                        }
                        else
                        {
                            int inId = spStockPosting.ReturnBatchIdFromStockPosting(decProductIdForEdit);
                            infoStockPosting.BatchId = inId;
                        }

                    }
                    else
                    {
                        infoStockPosting.BatchId = Convert.ToDecimal(dgvProductCreation.Rows[inI].Cells["dgvtxtbatchId"].Value);
                    }

                    isStpUpdated = spStockPosting.StockPostingEdit(infoStockPosting);


                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:23" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }



        }