protected void btnSave_Click(object sender, EventArgs e)
    {
        btnSave.Focus();
        DropPayout dropPayout = new DropPayout();
        DropPayoutManager dropPayoutManager = new DropPayoutManager(this);

        if (ucCurrFieldAmount.CurrencyValue.HasValue)
            dropPayout.Amount = ucCurrFieldAmount.CurrencyValue.Value;

        if (rbtSangria.Checked)
            dropPayout.Amount = Decimal.Negate(dropPayout.Amount);

        dropPayout.Comment = txtReason.Text;
        dropPayout.CompanyId = Company.CompanyId;

        if (Deposit == null)
            dropPayout.DepositId = Convert.ToInt32(cboDeposit.SelectedValue);
        else
            dropPayout.DepositId = Deposit.DepositId;
                
        dropPayout.ModifiedDate = DateTime.Now;
        dropPayout.UserId = User.Identity.UserId;
        dropPayoutManager.Insert(dropPayout);

        txtReason.Text = String.Empty;
        ucCurrFieldAmount.CurrencyValue = null;
        rbtSangria.Checked = true;
        Server.Transfer("DropPayoutReport.aspx");
    }
Пример #2
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        Inventory        inv      = new Inventory();
        InventoryManager iManager = new InventoryManager(this);

        foreach (GridViewRow row in grdDevolution.Rows)
        {
            if (row.RowType == DataControlRowType.DataRow)
            {
                inv = iManager.GetInventory(Company.CompanyId,
                                            Convert.ToInt16(grdDevolution.DataKeys[row.RowIndex]["ProductId"]),
                                            Deposit.DepositId);
                inv.RealCost  = Convert.ToDecimal(grdDevolution.DataKeys[row.RowIndex]["UnitCost"]);
                inv.UnitPrice = Convert.ToDecimal(grdDevolution.DataKeys[row.RowIndex]["UnitPrice"]);
                inv.Quantity  = Convert.ToInt16(grdDevolution.DataKeys[row.RowIndex]["Quantity"]);

                iManager.StockDeposit(inv, null, User.Identity.UserId);

                //his.CompanyId = Company.CompanyId;
                //his.DepositId = Deposit.DepositId;
                //his.DestinationDepositId = Deposit.DepositId;
                //his.InventoryEntryTypeId = (int)EntryType.Devolution;
                //his.LogDate = DateTime.Now;
                //his.CurrencyRateId = inv.CurrencyRateId;
                //his.FiscalNumber = inv.FiscalNumber;
                //his.Localization = inv.Localization;
                //his.MinimumRequired = inv.MinimumRequired;
                //his.ProductId = inv.ProductId;
                //his.Profit = inv.Profit;
                //his.Quantity = Convert.ToInt16(grdDevolution.DataKeys[row.RowIndex]["Quantity"]);
                //his.RealCost = Convert.ToDecimal(grdDevolution.DataKeys[row.RowIndex]["UnitCost"]);
                //his.UnitPrice = Convert.ToDecimal(grdDevolution.DataKeys[row.RowIndex]["UnitPrice"]);
                //his.SupplierId = inv.SupplierId;

                //iManager.InsertHistory(his);
            }
        }

        DropPayout        dp       = new DropPayout();
        DropPayoutManager dManager = new DropPayoutManager(this);

        dp.Amount       = Convert.ToDecimal(txtDevolutionValue.Text);
        dp.Comment      = "Devolução de items da venda nº " + txtSaleNumber.Text;
        dp.CompanyId    = Company.CompanyId;
        dp.DepositId    = Deposit.DepositId;
        dp.ModifiedDate = DateTime.Now;
        dp.UserId       = User.Identity.UserId;

        dManager.Insert(dp);

        Context.Items["OK"] = "OK";
        Server.Transfer("Exchange.aspx");
    }
Пример #3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        btnSave.Focus();
        DropPayout        dropPayout        = new DropPayout();
        DropPayoutManager dropPayoutManager = new DropPayoutManager(this);

        if (ucCurrFieldAmount.CurrencyValue.HasValue)
        {
            dropPayout.Amount = ucCurrFieldAmount.CurrencyValue.Value;
        }

        if (rbtSangria.Checked)
        {
            dropPayout.Amount = Decimal.Negate(dropPayout.Amount);
        }

        dropPayout.Comment   = txtReason.Text;
        dropPayout.CompanyId = Company.CompanyId;

        if (Deposit == null)
        {
            dropPayout.DepositId = Convert.ToInt32(cboDeposit.SelectedValue);
        }
        else
        {
            dropPayout.DepositId = Deposit.DepositId;
        }

        dropPayout.ModifiedDate = DateTime.Now;
        dropPayout.UserId       = User.Identity.UserId;
        dropPayoutManager.Insert(dropPayout);

        txtReason.Text = String.Empty;
        ucCurrFieldAmount.CurrencyValue = null;
        rbtSangria.Checked = true;
        Server.Transfer("DropPayoutReport.aspx");
    }
Пример #4
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        Inventory inv = new Inventory();        
        InventoryManager iManager = new InventoryManager(this);

        foreach (GridViewRow row in grdDevolution.Rows)
        {
            if (row.RowType == DataControlRowType.DataRow)
            {
                inv = iManager.GetInventory(Company.CompanyId,
                    Convert.ToInt16(grdDevolution.DataKeys[row.RowIndex]["ProductId"]),
                    Deposit.DepositId);
                inv.RealCost = Convert.ToDecimal(grdDevolution.DataKeys[row.RowIndex]["UnitCost"]);
                inv.UnitPrice = Convert.ToDecimal(grdDevolution.DataKeys[row.RowIndex]["UnitPrice"]);
                inv.Quantity = Convert.ToInt16(grdDevolution.DataKeys[row.RowIndex]["Quantity"]);

                iManager.StockDeposit(inv, null, User.Identity.UserId);

                //his.CompanyId = Company.CompanyId;
                //his.DepositId = Deposit.DepositId;
                //his.DestinationDepositId = Deposit.DepositId;
                //his.InventoryEntryTypeId = (int)EntryType.Devolution;
                //his.LogDate = DateTime.Now;
                //his.CurrencyRateId = inv.CurrencyRateId;
                //his.FiscalNumber = inv.FiscalNumber;
                //his.Localization = inv.Localization;
                //his.MinimumRequired = inv.MinimumRequired;
                //his.ProductId = inv.ProductId;
                //his.Profit = inv.Profit;
                //his.Quantity = Convert.ToInt16(grdDevolution.DataKeys[row.RowIndex]["Quantity"]);
                //his.RealCost = Convert.ToDecimal(grdDevolution.DataKeys[row.RowIndex]["UnitCost"]);
                //his.UnitPrice = Convert.ToDecimal(grdDevolution.DataKeys[row.RowIndex]["UnitPrice"]);
                //his.SupplierId = inv.SupplierId;

                //iManager.InsertHistory(his);
            }
        }

        DropPayout dp = new DropPayout();
        DropPayoutManager dManager = new DropPayoutManager(this);
        dp.Amount = Convert.ToDecimal(txtDevolutionValue.Text);
        dp.Comment = "Devolução de items da venda nº " + txtSaleNumber.Text;
        dp.CompanyId = Company.CompanyId;
        dp.DepositId = Deposit.DepositId;
        dp.ModifiedDate = DateTime.Now;
        dp.UserId = User.Identity.UserId;

        dManager.Insert(dp);

        Context.Items["OK"] = "OK";
        Server.Transfer("Exchange.aspx");
    }
Пример #5
0
 /// <summary>
 /// Método utilizado para inserir uma entrada na Tabela
 /// </summary>
 /// <param name="entity"></param>
 public void Insert(DropPayout entity)
 {
     DbContext.DropPayouts.InsertOnSubmit(entity);
     DbContext.SubmitChanges();
 }