Exemplo n.º 1
0
        protected void btnReturn_Click(object sender, EventArgs e)
        {
            int fixedAssetId = (int)Session["fixedAssetId"];

            FixedAsset fa = _presenter.GetFixedAsset(fixedAssetId);

            if (fa.Custodian == "Store")
            {
                Master.ShowMessage(new AppMessage("The current item is still in the Store!", RMessageType.Error));
            }
            else
            {
                fa.Custodian = "Store";

                FixedAssetHistory fah = new FixedAssetHistory();
                fah.TransactionDate = DateTime.Now;
                fah.Custodian       = "Store";
                fah.Operation       = "Returned";

                fa.FixedAssetHistories.Add(fah);

                _presenter.SaveOrUpdateFixedAsset(fa);
                BindFixedAssets();
                Session["fixedAssetId"] = null;

                Master.ShowMessage(new AppMessage("Fixed Asset successfully returned to the Store!", RMessageType.Info));
            }
        }
Exemplo n.º 2
0
        protected void btnTransferFA_Click(object sender, EventArgs e)
        {
            int fixedAssetId = (int)Session["fixedAssetId"];

            FixedAsset fa = _presenter.GetFixedAsset(fixedAssetId);

            if (fa.Custodian == "Store")
            {
                Master.ShowMessage(new AppMessage("Transfer can only be done from a person to another person!", RMessageType.Error));
            }
            else
            {
                fa.Custodian = ddlNewCustodian.SelectedValue;

                FixedAssetHistory fah = new FixedAssetHistory();
                fah.TransactionDate = DateTime.Now;
                fah.Custodian       = ddlNewCustodian.SelectedValue;
                fah.Operation       = "Transfered";

                fa.FixedAssetHistories.Add(fah);

                _presenter.SaveOrUpdateFixedAsset(fa);
                BindFixedAssets();
                Session["fixedAssetId"] = null;

                Master.ShowMessage(new AppMessage("Fixed Asset successfully transfered!", RMessageType.Info));
            }
        }
Exemplo n.º 3
0
        protected void btnUpdateFA_Click(object sender, EventArgs e)
        {
            int fixedAssetId = (int)Session["fixedAssetId"];

            FixedAsset fa = _presenter.GetFixedAsset(fixedAssetId);

            fa.AssetCode   = txtAssetCode.Text;
            fa.SerialNo    = txtSerialNo.Text;
            fa.Location    = txtLocation.Text;
            fa.Condition   = txtCondition.Text;
            fa.TotalLife   = Convert.ToInt32(txtTotalLife.Text);
            fa.Remark      = txtRemark.Text;
            fa.AssetStatus = "Updated";

            FixedAssetHistory fah = new FixedAssetHistory();

            fah.TransactionDate = DateTime.Now;
            fah.Custodian       = "Store";
            fah.Operation       = "Updated";

            fa.FixedAssetHistories.Add(fah);

            _presenter.SaveOrUpdateFixedAsset(fa);
            BindFixedAssets();
            Session["fixedAssetId"] = null;

            Master.ShowMessage(new AppMessage("Fixed Asset successfully updated!", RMessageType.Info));
        }
Exemplo n.º 4
0
        public void SaveOrUpdateReceive()
        {
            Receive receive = CurrentReceive;

            if (receive.Id <= 0)
            {
                receive.ReceiveNo = View.GetReceiveNo;
            }
            receive.ReceiveDate = Convert.ToDateTime(DateTime.Today.ToShortDateString());
            receive.DeliveredBy = View.GetDeliveredBy;
            receive.InvoiceNo   = View.GetInvoiceNo;
            receive.Program     = _settingController.GetProgram(View.GetProgram);
            receive.Project     = _settingController.GetProject(View.GetProject);
            receive.Grant       = _settingController.GetGrant(View.GetGrant);
            receive.Receiver    = _adminController.GetUser(CurrentUser().Id).Id;
            receive.Supplier    = _settingController.GetSupplier(View.GetSupplier);

            foreach (ReceiveDetail recDet in CurrentReceive.ReceiveDetails)
            {
                if (recDet.Item.ItemType == "Fixed Asset")
                {
                    for (int i = 1; i <= recDet.Quantity; i++)
                    {
                        FixedAsset fa = new FixedAsset();
                        fa.Item        = recDet.Item;
                        fa.ReceiveDate = CurrentReceive.ReceiveDate;
                        fa.Supplier    = CurrentReceive.Supplier;
                        fa.Store       = recDet.Store;
                        fa.Section     = recDet.Section;
                        fa.Shelf       = recDet.Shelf;
                        fa.ReceiveNo   = CurrentReceive.ReceiveNo;
                        fa.Custodian   = "Store";
                        fa.UnitCost    = recDet.UnitCost;
                        fa.AssetStatus = "Received";

                        FixedAssetHistory fah = new FixedAssetHistory();
                        fah.Custodian       = "Store";
                        fah.Operation       = "Receive";
                        fah.TransactionDate = DateTime.Now;

                        fa.FixedAssetHistories.Add(fah);

                        _controller.SaveOrUpdateEntity(fa);
                    }
                }
            }

            _controller.SaveOrUpdateEntity(receive);
        }
Exemplo n.º 5
0
        protected void btnReturn_Click(object sender, EventArgs e)
        {
            int fixedAssetId = (int)Session["fixedAssetId"];

            FixedAsset fa = _presenter.GetFixedAsset(fixedAssetId);

            if (fa.Custodian == "Store")
            {
                Master.ShowMessage(new AppMessage("The current item is still in the Store!", RMessageType.Error));
            }
            else
            {
                fa.Custodian    = "Store";
                fa.Store        = _presenter.GetStore(Convert.ToInt32(ddlStore.SelectedValue));
                fa.Section      = _presenter.GetSection(Convert.ToInt32(ddlSection.SelectedValue));
                fa.Shelf        = _presenter.GetShelf(Convert.ToInt32(ddlSection.SelectedValue));
                fa.AssetStatus  = FixedAssetStatus.UpdatedInStore.ToString();
                fa.CheckedByIt  = ckCheckedByIt.Checked;
                fa.ReturnRemark = txtReturnRemark.Text;

                FixedAssetHistory fah = new FixedAssetHistory();
                fah.TransactionDate = DateTime.Now;
                fah.Custodian       = "Store";
                fah.Operation       = "Returned";

                fa.FixedAssetHistories.Add(fah);

                //Add the received quantity to the stock
                Stock stock = _presenter.GetStockByItem(fa.Item.Id);
                stock.Quantity = stock.Quantity + 1;
                _presenter.SaveOrUpdateStock(stock);

                _presenter.SaveOrUpdateFixedAsset(fa);
                BindFixedAssets();
                Session["fixedAssetId"] = null;

                Master.ShowMessage(new AppMessage("Fixed Asset successfully returned to the Store!", RMessageType.Info));
            }
        }
Exemplo n.º 6
0
        protected void btnFAIssue_Click(object sender, EventArgs e)
        {
            try
            {
                IssueDetail issueDetail;
                int         issDetId = (int)Session["IssueDetailId"];

                if (issDetId > 0)
                {
                    issueDetail = _presenter.CurrentIssue.GetIssueDetail(issDetId);
                    issueDetail.PreviousQuantity = issueDetail.Quantity;
                }
                else
                {
                    issueDetail = _presenter.CurrentIssue.IssueDetails[(int)Session["detailIndex"]];
                }

                string issuedTo = "";
                if (rbChaiEmp.Checked)
                {
                    issuedTo = _presenter.GetUser(Convert.ToInt32(ddlCustodian.SelectedValue)).FullName;
                }
                else if (rbOther.Checked)
                {
                    issuedTo = txtOtherCustodian.Text;
                }

                FixedAsset fa = _presenter.GetFixedAsset(Convert.ToInt32(ddlAssetCode.SelectedValue));
                fa.Store       = null;
                fa.Section     = null;
                fa.Shelf       = null;
                fa.AssetStatus = FixedAssetStatus.ToBeIssued.ToString();
                _presenter.SaveOrUpdateFixedAsset(fa);

                fa.Custodian = issuedTo;

                FixedAssetHistory fah = new FixedAssetHistory();
                fah.TransactionDate = DateTime.Now;
                fah.Custodian       = issuedTo;
                fah.Operation       = "Issue";

                fa.FixedAssetHistories.Add(fah);

                issueDetail.Store      = fa.Store;
                issueDetail.Section    = fa.Section;
                issueDetail.Shelf      = fa.Shelf;
                issueDetail.UnitCost   = fa.UnitCost;
                issueDetail.Quantity   = 1;
                issueDetail.Custodian  = issuedTo;
                issueDetail.FixedAsset = fa;

                if (Session["IssueDetailId"] == null)
                {
                    _presenter.CurrentIssue.IssueDetails.Add(issueDetail);
                }
                else
                {
                    _presenter.CurrentIssue.IssueDetails[(int)Session["detailIndex"]] = issueDetail;
                }

                BindIssueDetails();
                btnSave.Visible          = true;
                Session["IssueDetailId"] = null;
                Session["detailIndex"]   = null;

                Master.ShowMessage(new AppMessage("Issue Detail for Fixed Asset Updated!", RMessageType.Info));
            }
            catch (Exception ex)
            {
                Master.ShowMessage(new AppMessage(ex.Message, RMessageType.Error));
                ExceptionUtility.LogException(ex, ex.Source);
                ExceptionUtility.NotifySystemOps(ex, _presenter.CurrentUser().FullName);
            }
        }