public void PhysicalStockMasterEdit(PhysicalStockMasterInfo physicalstockmasterinfo)
 {
     try
     {
         spPhysicalStockMaster.PhysicalStockMasterEdit(physicalstockmasterinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("PS9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="InfoPhysicalStockMaster"></param>
 public void PhysicalStockMasterEdit(PhysicalStockMasterInfo InfoPhysicalStockMaster)
 {
     try
     {
         SPPhysicalStockMaster.PhysicalStockMasterEdit(InfoPhysicalStockMaster);
     }
     catch (Exception ex)
     {
         MessageBox.Show("PS6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        public PhysicalStockMasterInfo PhysicalStockMasterView(decimal physicalStockMasterId)
        {
            PhysicalStockMasterInfo infoPhysicalStockMaster = new PhysicalStockMasterInfo();

            try
            {
                infoPhysicalStockMaster = spPhysicalStockMaster.PhysicalStockMasterView(physicalStockMasterId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PS6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(infoPhysicalStockMaster);
        }
        /// <summary>
        /// Function to insert values to PhysicalStockMaster Table
        /// </summary>
        /// <param name="physicalstockmasterinfo"></param>
        /// <returns></returns>
        public decimal PhysicalStockMasterAdd(PhysicalStockMasterInfo physicalstockmasterinfo)
        {
            decimal decIdentity = 0;

            try
            {
                decIdentity = spPhysicalStockMaster.PhysicalStockMasterAdd(physicalstockmasterinfo);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PS3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(decIdentity);
        }
예제 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="InfoPhysicalStockMaster"></param>
        /// <returns></returns>
        public decimal PhysicalStockMasterAdd(PhysicalStockMasterInfo InfoPhysicalStockMaster)
        {
            decimal decResult = 0;

            try
            {
                decResult = SPPhysicalStockMaster.PhysicalStockMasterAdd(InfoPhysicalStockMaster);
            }
            catch (Exception ex)
            {
                MessageBox.Show("PS7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(decResult);
        }
 /// <summary>
 /// Function to Update values in PhysicalStockMaster Table
 /// </summary>
 /// <param name="physicalstockmasterinfo"></param>
 public void PhysicalStockMasterEdit(PhysicalStockMasterInfo physicalstockmasterinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PhysicalStockMasterEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@physicalStockMasterId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.PhysicalStockMasterId;
         sprmparam       = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.VoucherNo;
         sprmparam       = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.InvoiceNo;
         sprmparam       = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.SuffixPrefixId;
         sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.VoucherTypeId;
         sprmparam       = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = physicalstockmasterinfo.Date;
         sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.Narration;
         sprmparam       = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.TotalAmount;
         sprmparam       = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.FinancialYearId;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = physicalstockmasterinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
예제 #7
0
        public decimal PhysicalStockMasterAdd(PhysicalStockMasterInfo physicalstockmasterinfo)
        {
            decimal decIdentity = 0m;

            try
            {
                if (base.sqlcon.State == ConnectionState.Closed)
                {
                    base.sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PhysicalStockMasterAdd", base.sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam11 = new SqlParameter();
                sprmparam11       = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
                sprmparam11.Value = physicalstockmasterinfo.VoucherNo;
                sprmparam11       = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
                sprmparam11.Value = physicalstockmasterinfo.InvoiceNo;
                sprmparam11       = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
                sprmparam11.Value = physicalstockmasterinfo.SuffixPrefixId;
                sprmparam11       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
                sprmparam11.Value = physicalstockmasterinfo.VoucherTypeId;
                sprmparam11       = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
                sprmparam11.Value = physicalstockmasterinfo.Date;
                sprmparam11       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam11.Value = physicalstockmasterinfo.Narration;
                sprmparam11       = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
                sprmparam11.Value = physicalstockmasterinfo.TotalAmount;
                sprmparam11       = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
                sprmparam11.Value = physicalstockmasterinfo.FinancialYearId;
                sprmparam11       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam11.Value = physicalstockmasterinfo.Extra1;
                sprmparam11       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam11.Value = physicalstockmasterinfo.Extra2;
                decIdentity       = Convert.ToDecimal(sccmd.ExecuteScalar());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                base.sqlcon.Close();
            }
            return(decIdentity);
        }
        /// <summary>
        /// Function to get particular values from PhysicalStockMaster table based on the parameter
        /// </summary>
        /// <param name="physicalStockMasterId"></param>
        /// <returns></returns>
        public PhysicalStockMasterInfo PhysicalStockMasterView(decimal physicalStockMasterId)
        {
            PhysicalStockMasterInfo physicalstockmasterinfo = new PhysicalStockMasterInfo();
            SqlDataReader           sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PhysicalStockMasterView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@physicalStockMasterId", SqlDbType.Decimal);
                sprmparam.Value = physicalStockMasterId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    physicalstockmasterinfo.PhysicalStockMasterId = decimal.Parse(sdrreader[0].ToString());
                    physicalstockmasterinfo.VoucherNo             = sdrreader[1].ToString();
                    physicalstockmasterinfo.InvoiceNo             = sdrreader[2].ToString();
                    physicalstockmasterinfo.SuffixPrefixId        = decimal.Parse(sdrreader[3].ToString());
                    physicalstockmasterinfo.VoucherTypeId         = decimal.Parse(sdrreader[4].ToString());
                    physicalstockmasterinfo.Date            = DateTime.Parse(sdrreader[5].ToString());
                    physicalstockmasterinfo.Narration       = sdrreader[6].ToString();
                    physicalstockmasterinfo.TotalAmount     = decimal.Parse(sdrreader[7].ToString());
                    physicalstockmasterinfo.FinancialYearId = decimal.Parse(sdrreader[8].ToString());
                    physicalstockmasterinfo.ExtraDate       = DateTime.Parse(sdrreader[9].ToString());
                    physicalstockmasterinfo.Extra1          = sdrreader[10].ToString();
                    physicalstockmasterinfo.Extra2          = sdrreader[11].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(physicalstockmasterinfo);
        }
        /// <summary>
        /// Fill function for updation
        /// </summary>
        public void FillFunction()
        {
            try
            {
                PhysicalStockMasterInfo infoPhysicalStockMaster = new PhysicalStockMasterInfo();
                //PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP();
                PhysicalStockBll BllPhysicalStock = new PhysicalStockBll();
                VoucherTypeBll BllVoucherType = new VoucherTypeBll();
                infoPhysicalStockMaster = BllPhysicalStock.PhysicalStockMasterView(decMasterId);
                txtVoucherNo.Text = infoPhysicalStockMaster.InvoiceNo;
                strVoucherNo = infoPhysicalStockMaster.VoucherNo.ToString();
                decPhysicalStockSuffixPrefixId = Convert.ToDecimal(infoPhysicalStockMaster.SuffixPrefixId);
                decPhysicalStockVoucherTypeId = Convert.ToDecimal(infoPhysicalStockMaster.VoucherTypeId);
                isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decPhysicalStockVoucherTypeId);
                txtDate.Text = infoPhysicalStockMaster.Date.ToString("dd-MMM-yyyy");
                txtNarration.Text = infoPhysicalStockMaster.Narration;
                txtTotalAmount.Text = infoPhysicalStockMaster.TotalAmount.ToString();
                List<DataTable> ListObj = new List<DataTable>();
                ListObj = BllPhysicalStock.PhysicalStockViewbyMasterId(decMasterId);
                isFromEditMode = true;
                for (int i = 0; i < ListObj[0].Rows.Count; i++)
                {

                    dgvPhysicalStock.Rows.Add();
                    dgvPhysicalStock.Rows[i].HeaderCell.Value = string.Empty;
                    dgvPhysicalStock.Rows[i].Cells["dgvtxtPhysicalStockDetailId"].Value = Convert.ToDecimal(ListObj[0].Rows[i]["physicalStockDetailsId"].ToString());
                    dgvPhysicalStock.Rows[i].Cells["dgvtxtSlNo"].Value = ListObj[0].Rows[i]["slno"].ToString();
                    dgvPhysicalStock.Rows[i].Cells["dgvtxtProductCode"].Value = ListObj[0].Rows[i]["productCode"].ToString();
                    dgvPhysicalStock.Rows[i].Cells["dgvtxtProductName"].Value = ListObj[0].Rows[i]["productName"].ToString();
                    dgvPhysicalStock.Rows[i].Cells["dgvtxtQty"].Value = ListObj[0].Rows[i]["qty"].ToString();
                    BatchComboFill(Convert.ToDecimal(ListObj[0].Rows[i]["productId"].ToString()), i, dgvPhysicalStock.Rows[i].Cells["dgvcmbBatch"].ColumnIndex);
                    dgvPhysicalStock.Rows[i].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(ListObj[0].Rows[i]["batchId"].ToString());
                    dgvPhysicalStock.Rows[i].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(ListObj[0].Rows[i]["unitId"].ToString());
                    dgvPhysicalStock.Rows[i].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(ListObj[0].Rows[i]["godownId"].ToString());
                    dgvPhysicalStock.Rows[i].Cells["dgvcmbRack"].Value = Convert.ToDecimal(ListObj[0].Rows[i]["rackId"].ToString());
                    dgvPhysicalStock.Rows[i].Cells["dgvtxtRate"].Value = ListObj[0].Rows[i]["rate"].ToString();
                    dgvPhysicalStock.Rows[i].Cells["dgvtxtAmount"].Value = ListObj[0].Rows[i]["amount"].ToString();
                    dgvPhysicalStock.Rows[i].Cells["dgvtxtBarcode"].Value = ListObj[0].Rows[i]["barcode"].ToString();
                    if (dgvPhysicalStock.Columns.Count > 0)
                    {
                        dgvPhysicalStock.Columns["dgvtxtRate"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvPhysicalStock.Columns["dgvtxtAmount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                    }
                }
                isFromEditMode = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("PS:8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Save Function
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         ProductInfo infoProduct = new ProductInfo();
         ProductCreationBll BllProductCreation = new ProductCreationBll();
         PhysicalStockMasterInfo infoPhysicalStockMaster = new PhysicalStockMasterInfo();
         //PhysicalStockDetailsSP spPhysicalStockDetails = new PhysicalStockDetailsSP();
         PhysicalStockBll BllPhysicalStock = new PhysicalStockBll();
         //PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP();
         infoPhysicalStockMaster.VoucherNo = txtVoucherNo.Text.Trim();
         infoPhysicalStockMaster.Date = Convert.ToDateTime(txtDate.Text);
         infoPhysicalStockMaster.Narration = txtNarration.Text.Trim();
         string s = txtTotalAmount.Text;
         infoPhysicalStockMaster.TotalAmount = Convert.ToDecimal(txtTotalAmount.Text);
         if (isAutomatic)
         {
             infoPhysicalStockMaster.SuffixPrefixId = decPhysicalStockSuffixPrefixId;
             infoPhysicalStockMaster.VoucherNo = strVoucherNo;
             infoPhysicalStockMaster.InvoiceNo = txtVoucherNo.Text;
         }
         else
         {
             infoPhysicalStockMaster.SuffixPrefixId = 0;
             infoPhysicalStockMaster.VoucherNo = txtVoucherNo.Text;
             infoPhysicalStockMaster.InvoiceNo = txtVoucherNo.Text;
         }
         infoPhysicalStockMaster.VoucherTypeId = decPhysicalStockVoucherTypeId;
         infoPhysicalStockMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
         infoPhysicalStockMaster.Extra1 = string.Empty;
         infoPhysicalStockMaster.Extra2 = string.Empty;
         decPhysicalStockMasterIdentity = Convert.ToDecimal(BllPhysicalStock.PhysicalStockMasterAdd(infoPhysicalStockMaster));
         int inRowcount = dgvPhysicalStock.Rows.Count;
         for (int inI = 0; inI < inRowcount - 1; inI++)
         {
             if (dgvPhysicalStock.Rows[inI].HeaderCell.Value.ToString() != "X")
             {
                 infoPhysicalStockDetails.PhysicalStockMasterId = decPhysicalStockMasterIdentity;
                 if (dgvPhysicalStock.Rows[inI].Cells["dgvtxtProductCode"].Value != null && dgvPhysicalStock.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString() != string.Empty)
                 {
                     infoProduct = BllProductCreation.ProductViewByCode(dgvPhysicalStock.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString());
                     infoPhysicalStockDetails.ProductId = infoProduct.ProductId;
                 }
                 if (dgvPhysicalStock.Rows[inI].Cells["dgvcmbGodown"].Value != null && dgvPhysicalStock.Rows[inI].Cells["dgvcmbGodown"].Value.ToString() != string.Empty)
                 {
                     infoPhysicalStockDetails.GodownId = Convert.ToDecimal(dgvPhysicalStock.Rows[inI].Cells["dgvcmbGodown"].Value.ToString());
                 }
                 else
                 {
                     infoPhysicalStockDetails.GodownId = 0;
                 }
                 if (dgvPhysicalStock.Rows[inI].Cells["dgvcmbRack"].Value != null && dgvPhysicalStock.Rows[inI].Cells["dgvcmbRack"].Value.ToString() != string.Empty)
                 {
                     infoPhysicalStockDetails.RackId = Convert.ToDecimal(dgvPhysicalStock.Rows[inI].Cells["dgvcmbRack"].Value.ToString());
                 }
                 else
                 {
                     infoPhysicalStockDetails.RackId = 0;
                 }
                 if (dgvPhysicalStock.Rows[inI].Cells["dgvcmbBatch"].Value != null && dgvPhysicalStock.Rows[inI].Cells["dgvcmbBatch"].Value.ToString() != string.Empty)
                 {
                     infoPhysicalStockDetails.BatchId = Convert.ToDecimal(Convert.ToString(dgvPhysicalStock.Rows[inI].Cells["dgvcmbBatch"].Value));
                 }
                 else
                 {
                     infoPhysicalStockDetails.BatchId = 0;
                 }
                 if (dgvPhysicalStock.Rows[inI].Cells["dgvtxtQty"].Value != null && dgvPhysicalStock.Rows[inI].Cells["dgvtxtQty"].Value.ToString() != string.Empty)
                 {
                     infoPhysicalStockDetails.Qty = Convert.ToDecimal(dgvPhysicalStock.Rows[inI].Cells["dgvtxtQty"].Value.ToString());
                 }
                 if (dgvPhysicalStock.Rows[inI].Cells["dgvcmbUnit"].Value != null && dgvPhysicalStock.Rows[inI].Cells["dgvcmbUnit"].Value.ToString() != string.Empty)
                 {
                     infoPhysicalStockDetails.UnitId = Convert.ToDecimal(dgvPhysicalStock.Rows[inI].Cells["dgvcmbUnit"].Value.ToString());
                     infoPhysicalStockDetails.UnitConversionId = decConversionId;
                 }
                 infoPhysicalStockDetails.Rate = Convert.ToDecimal(dgvPhysicalStock.Rows[inI].Cells["dgvtxtRate"].Value.ToString());
                 infoPhysicalStockDetails.Amount = Convert.ToDecimal(dgvPhysicalStock.Rows[inI].Cells["dgvtxtAmount"].Value.ToString());
                 infoPhysicalStockDetails.Slno = Convert.ToInt32(dgvPhysicalStock.Rows[inI].Cells["dgvtxtSlNo"].Value.ToString());
                 infoPhysicalStockDetails.Extra1 = string.Empty;
                 infoPhysicalStockDetails.Extra2 = string.Empty;
                 BllPhysicalStock.PhysicalStockDetailsAdd(infoPhysicalStockDetails);
                 decimal decPId = infoPhysicalStockDetails.ProductId;
                 string strVoucher = infoPhysicalStockMaster.VoucherNo;
                 AddtoStockPosting(decPId, strVoucher);
             }
         }
         Messages.SavedMessage();
         if (dgvPhysicalStock.RowCount > 1)
         {
             if (cbxPrint.Checked)
             {
                 if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                 {
                     PrintForDotMatrix(decPhysicalStockMasterIdentity);
                 }
                 else
                 {
                     Print(decPhysicalStockMasterIdentity);
                 }
             }
         }
         clear();
     }
     catch (Exception ex)
     {
         MessageBox.Show("PS:27" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }