Esempio n. 1
0
 private void SelectTxnNoAdjust()
 {
     if (grdAdjustment.RowCount > 0)
     {
         _MutationHd = new MutationHd {
             TxnNo = grdAdjustment.SelectedRows[0].Cells["TxnNo"].Value.ToString(), InventoryTxnID = strInventoryTxnID.Trim()
         };
         _MutationHd.SelectOne();
         Close();
     }
 }
Esempio n. 2
0
        private bool _DeleteHd()
        {
            bool _retval = false;
            var  omhd    = new MutationHd();

            omhd.TxnNo      = txtTxnNo.Text.Trim();
            omhd.UserDelete = _loginInfo.UserID;
            omhd.Delete();
            omhd.Dispose();
            omhd = null;
            return(_retval);
        }
Esempio n. 3
0
        private void openTxnNo()
        {
            var oMutationhd = new MutationHd();

            oMutationhd.InventoryTxnID = Convert.ToString(cboTxnType.SelectedValue);
            oMutationhd.TxnNo          = txtTxnNo.Text.Trim();
            if (oMutationhd.SelectOne().Rows.Count > 0)
            {
                txtTxnNo.Text              = oMutationhd.TxnNo;
                dtpTxnDate.Value           = oMutationhd.TxnDate;
                cboReason.SelectedValue    = oMutationhd.AdjustmentReasonID.Trim();
                cboWarehouse.SelectedValue = oMutationhd.SourceWHID.Trim();
                cboUnit.SelectedValue      = oMutationhd.SourceUnitID.Trim();
                txtDescription.Text        = oMutationhd.Description.Trim();
                cboTxnType.Enabled         = false;;
                PopulateGrid();

                if (oMutationhd.IsApproval)
                {
                    lblApproved.Visible   = true;
                    btnApprove.Enabled    = false;
                    btnDeleteAll.Enabled  = false;
                    btnDelete.Enabled     = false;
                    btnSave.Enabled       = false;
                    btnClear.Enabled      = false;
                    btnSearchItem.Enabled = false;
                }
                else
                {
                    lblApproved.Visible = false;
                    btnApprove.Enabled  = true;

                    btnDeleteAll.Enabled  = true;
                    btnDelete.Enabled     = true;
                    btnSave.Enabled       = true;
                    btnClear.Enabled      = true;
                    btnSearchItem.Enabled = true;
                }
            }
            else
            {
                _ClearAll();
            }
            oMutationhd.Dispose();
            oMutationhd = null;
        }
Esempio n. 4
0
        private void Approval()
        {
            if (Program.MsgBox_Show("Are you sure want to approve this transaction ? ", "Confirmation", "YesNo"))
            {
                var oMutationhd = new MutationHd();
                oMutationhd.InventoryTxnID = Convert.ToString(cboTxnType.SelectedValue);
                oMutationhd.TxnNo          = txtTxnNo.Text.Trim();
                if (oMutationhd.SelectOne().Rows.Count > 0)
                {
                    if (oMutationhd.IsApproval)
                    {
                        Program.MsgBox_Show("Transaction no. is already approved, please refresh your screen.");
                    }
                    else
                    {
                        var oItemHistory = new ItemHistory();
                        oItemHistory.TxnNo      = txtTxnNo.Text.Trim();
                        oItemHistory.UserInsert = _loginInfo.UserID.Trim();
                        if (Convert.ToString(cboTxnType.SelectedValue).Trim() == "111")
                        {
                            oItemHistory.DoApproval(TxnType.AdjustmentMinus);
                        }
                        else
                        {
                            oItemHistory.DoApproval(TxnType.AdjustmentPlus);
                        }
                        oItemHistory.Dispose();
                        oItemHistory = null;

                        openTxnNo();
                    }
                }
                else
                {
                    Program.MsgBox_Show("Transaction no. not found.");
                }
                oMutationhd.Dispose();
                oMutationhd = null;
            }
        }
Esempio n. 5
0
        private void PopulateGrid()
        {
            grdAdjustment.SuspendLayout();
            grdAdjustment.AutoGenerateColumns = false;

            var adjustment = new MutationHd();
            var dtb        = new DataTable();

            if (_loginInfo.UserGroupID.Trim().ToUpper() == strUserGroupID.ToUpper())
            {
                dtb = adjustment.SelectBySTXnNo(strInventoryTxnID, string.Format(Program.FormatDateISO, dtpTransactionDateFrom.Value.Date), string.Format(Program.FormatDateISO, dtpTransactionDateTo.Value.Date), txtSTXnNoFrom.Text, txtSTXnNoTo.Text, Program.SelectOneByCommonSetting("MaxRecord"));
            }
            else
            {
                dtb = adjustment.SelectBySTXnNo(strInventoryTxnID, string.Format(Program.FormatDateISO, dtpTransactionDateFrom.Value.Date), string.Format(Program.FormatDateISO, dtpTransactionDateTo.Value.Date), txtSTXnNoFrom.Text, txtSTXnNoTo.Text, Program.SelectOneByCommonSetting("MaxRecord"), _loginInfo.UserID);
            }

            grdAdjustment.DataSource = dtb;

            grdAdjustment.ResumeLayout();
            adjustment.Dispose();
            adjustment = null;
        }
Esempio n. 6
0
        private bool _save()
        {
            bool _retval = false;

            //if (txtTxnNo.Text.Trim() == string.Empty)
            //{
            //    Program.MsgBox_Show("Transaction no. cannot empty.");
            //    return _retval;
            //}

            if (txtItemSeqNo.Text.Trim() == string.Empty)
            {
                Program.MsgBox_Show("Item cannot empty.");
                return(_retval);
            }

            if (txtItemName.Text.Trim() == string.Empty)
            {
                Program.MsgBox_Show("Item Name cannot empty.");
                return(_retval);
            }

            if (Convert.ToString(cboItemUnit.SelectedValue) == string.Empty || Convert.ToString(cboItemUnit.SelectedValue) == null)
            {
                Program.MsgBox_Show("Item Unit cannot empty.");
                return(_retval);
            }

            try
            {
                decimal.Parse(txtItemFactor.Text.Trim());
            }
            catch
            {
                Program.MsgBox_Show("Item Factor must be numeric.");
                return(_retval);
            }

            if (Convert.ToDecimal(txtItemFactor.Text.Trim()) < 1)
            {
                Program.MsgBox_Show("Item Factor must be equal or greater than 1");
                return(_retval);
            }

            try
            {
                decimal.Parse(txtQty.Text.Trim());
            }
            catch
            {
                Program.MsgBox_Show("Qty must be numeric.");
                return(_retval);
            }

            if (Convert.ToDecimal(txtQty.Text.Trim()) < 1)
            {
                Program.MsgBox_Show("Qty must be equal or greater than 1");
                return(_retval);
            }

            bool isNew = true;
            var  omhd  = new MutationHd();

            omhd.InventoryTxnID = Convert.ToString(cboTxnType.SelectedValue).Trim();
            omhd.TxnNo          = txtTxnNo.Text.Trim();
            if (omhd.SelectOne().Rows.Count > 0)
            {
                isNew = false;
            }
            else
            {
                string prefix;
                if (Convert.ToString(cboTxnType.SelectedValue).Trim() == "111")
                {
                    prefix = "AJM";
                }
                else
                {
                    prefix = "AJP";
                }
                isNew      = true;
                omhd.TxnNo = BussinessRules.ID.GenerateIDNumber("MutationHD", "TxnNo", prefix, "Where txnNo like '" + prefix + "%'");
            }
            omhd.TxnDate            = dtpTxnDate.Value.Date;
            omhd.AdjustmentReasonID = Convert.ToString(cboReason.SelectedValue).Trim();
            omhd.Description        = txtDescription.Text.Trim();
            omhd.SourceWHID         = Convert.ToString(cboWarehouse.SelectedValue);
            omhd.SourceUnitID       = Convert.ToString(cboUnit.SelectedValue);
            omhd.DestinationWHID    = "";
            omhd.DestinationUnitID  = "";
            omhd.UserInsert         = _loginInfo.UserID;
            omhd.UserUpdate         = _loginInfo.UserID;

            if (isNew)
            {
                if (omhd.Insert())
                {
                    txtTxnNo.Text = omhd.TxnNo;
                }
            }
            else
            {
                omhd.Update();
            }

            omhd.Dispose();
            omhd = null;

            var omdt = new MutationDt();

            omdt.InventoryTxnID = Convert.ToString(cboTxnType.SelectedValue).Trim();
            omdt.ID             = txtID.Text.Trim();
            if (omdt.SelectOne().Rows.Count > 0)
            {
                isNew = false;
            }
            else
            {
                string prefix;
                if (Convert.ToString(cboTxnType.SelectedValue).Trim() == "111")
                {
                    prefix = "AJM";
                }
                else
                {
                    prefix = "AJP";
                }
                isNew   = true;
                omdt.ID = BussinessRules.ID.GenerateIDNumber("MutationDt", "ID", prefix, "Where ID like '" + prefix + "%'");
            }
            omdt.ItemSeqNo  = txtItemSeqNo.Text.Trim();
            omdt.TxnNo      = txtTxnNo.Text.ToUpper().Trim();
            omdt.ItemUnitID = Convert.ToString(cboItemUnit.SelectedValue).Trim();
            omdt.ItemFactor = Convert.ToDecimal(txtItemFactor.Text.Trim());
            if (Convert.ToString(cboTxnType.SelectedValue) == "111")
            {
                omdt.Qty = Convert.ToDecimal(txtQty.Text.Trim()) * -1;
            }
            else
            {
                omdt.Qty = Convert.ToDecimal(txtQty.Text.Trim());
            }
            omdt.UserInsert = _loginInfo.UserID;
            omdt.UserUpdate = _loginInfo.UserID;

            if (isNew)
            {
                if (omdt.Insert())
                {
                    txtID.Text = omdt.ID;
                }
            }
            else
            {
                omdt.Update();
            }

            omdt.Dispose();
            omdt = null;

            _retval = true;
            return(_retval);
        }