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"); }
private void CalculateDropPayout(DateTime startDate, DateTime endDate) { DataTable sales = new DataTable(); DropPayoutManager dManager = new DropPayoutManager(this); SaleManager sManager = new SaleManager(this); Decimal total = (decimal)0; Decimal totalSangria = (decimal)0; Decimal totalSuplemento = (decimal)0; Decimal aVista = (decimal)0; // // This If is making sure that the code below will not execute in the rare case of the user do not // have a deposit registered. // if (Deposit != null) { IQueryable <DropPayout> sangria = dManager.GetSangriaByDate(Company.CompanyId, Deposit.DepositId, ucDateTimeInterval.DateInterval); rptSangria.DataSource = sangria; rptSangria.DataBind(); rptSangriaValores.DataSource = sangria; rptSangriaValores.DataBind(); IQueryable <DropPayout> suplemento = dManager.GetSuplementoByDate(Company.CompanyId, Deposit.DepositId, ucDateTimeInterval.DateInterval); rptSuplemento.DataSource = suplemento; rptSuplemento.DataBind(); rptSuplementoValores.DataSource = suplemento; rptSuplementoValores.DataBind(); sales = sManager.MapOfSale_Payment(Company.CompanyId, ucDateTimeInterval.DateInterval); rptFormasPagamento.DataSource = sales; rptValores.DataSource = sales; rptFormasPagamento.DataBind(); rptValores.DataBind(); for (int i = 0; i < sales.Rows.Count; i++) { total += Convert.ToDecimal(sales.Rows[i]["Value"]); if (sales.Rows[i]["Name"].ToString() == "Dinheiro") { aVista = Convert.ToDecimal(sales.Rows[i]["Value"]); } } foreach (DropPayout sang in sangria) { totalSangria += sang.Amount; } foreach (DropPayout sup in suplemento) { totalSuplemento += sup.Amount; } } lblCaixa.Text = (aVista + totalSangria + totalSuplemento).ToString("C"); lblTotalPagamento.Text = total.ToString("C"); lstExtract.DataBind(); }
private void CalculateDropPayout(DateTime startDate, DateTime endDate) { DataTable sales = new DataTable(); DropPayoutManager dManager = new DropPayoutManager(this); SaleManager sManager = new SaleManager(this); Decimal total = (decimal)0; Decimal totalSangria = (decimal)0; Decimal totalSuplemento = (decimal)0; Decimal aVista = (decimal)0; // // This If is making sure that the code below will not execute in the rare case of the user do not // have a deposit registered. // if (Deposit != null) { IQueryable<DropPayout> sangria = dManager.GetSangriaByDate(Company.CompanyId, Deposit.DepositId, ucDateTimeInterval.DateInterval); rptSangria.DataSource = sangria; rptSangria.DataBind(); rptSangriaValores.DataSource = sangria; rptSangriaValores.DataBind(); IQueryable<DropPayout> suplemento = dManager.GetSuplementoByDate(Company.CompanyId, Deposit.DepositId, ucDateTimeInterval.DateInterval); rptSuplemento.DataSource = suplemento; rptSuplemento.DataBind(); rptSuplementoValores.DataSource = suplemento; rptSuplementoValores.DataBind(); sales = sManager.MapOfSale_Payment(Company.CompanyId, ucDateTimeInterval.DateInterval); rptFormasPagamento.DataSource = sales; rptValores.DataSource = sales; rptFormasPagamento.DataBind(); rptValores.DataBind(); for (int i = 0; i < sales.Rows.Count; i++) { total += Convert.ToDecimal(sales.Rows[i]["Value"]); if (sales.Rows[i]["Name"].ToString() == "Dinheiro") aVista = Convert.ToDecimal(sales.Rows[i]["Value"]); } foreach (DropPayout sang in sangria) { totalSangria += sang.Amount; } foreach (DropPayout sup in suplemento) { totalSuplemento += sup.Amount; } } lblCaixa.Text = (aVista + totalSangria + totalSuplemento).ToString("C"); lblTotalPagamento.Text = total.ToString("C"); lstExtract.DataBind(); }
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"); }
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"); }