private void rbAsgariUcret_CheckedChanged(object sender, EventArgs e) { panelControl2.Visible = true; txtAGI.Focus(); this.IsCalculatedMinimumWage = true; if (this.rbAsgariUcret.Checked) { IhalematikProBL.Entity.Rule minimumWage = this.Rules.Where(p => p.RuleType == RuleTypesEnum.MinimumWage).FirstOrDefault(); txtBaseFare.Text = minimumWage.Value; if (this.Rules != null) { foreach (var item in this.Rules) { if (item.RuleType == RuleTypesEnum.IncomeTaxFare) { txtIncomeTaxFare.Text = (SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(minimumWage.Value) * SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(item.Value) / 100).ToString("c2"); } else if (item.RuleType == RuleTypesEnum.SGKPrimFare) { txtSGKPrimFare.Text = (SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(minimumWage.Value) * SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(item.Value) / 100).ToString("c2"); } else if (item.RuleType == RuleTypesEnum.StampTaxFare) { txtStampTaxFare.Text = (SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(minimumWage.Value) * SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(item.Value) / 100000).ToString("c2"); } else if (item.RuleType == RuleTypesEnum.WorklesFonFare) { txtWorklesFonFare.Text = (SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(minimumWage.Value) * SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(item.Value) / 100).ToString("c2"); } } } } }
private void rbAsgariUcret_CheckedChanged(object sender, EventArgs e) { panel1.Visible = true; this.IsCalculatedMinimumWage = true; if (this.rbAsgariUcret.Checked) { IhalematikProBL.Entity.Rule minimumWage = this.Rules.Where(p => p.RuleType == RuleTypesEnum.MinimumWage).FirstOrDefault(); txtBaseFare.Text = minimumWage.Value; if (this.Rules != null) { foreach (var item in this.Rules) { if (item.RuleType == RuleTypesEnum.IncomeTaxFare) { txtIncomeTaxFare.Text = (double.Parse(minimumWage.Value) * double.Parse(item.Value) / 100).ToString("c2"); } else if (item.RuleType == RuleTypesEnum.SGKPrimFare) { txtSGKPrimFare.Text = (double.Parse(minimumWage.Value) * double.Parse(item.Value) / 100).ToString("c2"); } else if (item.RuleType == RuleTypesEnum.StampTaxFare) { txtStampTaxFare.Text = (double.Parse(minimumWage.Value) * double.Parse(item.Value) / 100000).ToString("c2"); } else if (item.RuleType == RuleTypesEnum.WorklesFonFare) { txtWorklesFonFare.Text = (double.Parse(minimumWage.Value) * double.Parse(item.Value) / 100).ToString("c2"); } } } } }
private void LoadGrid() { LoadingManager.Instance.Show(this); List <MaterialList> items = UICurrentManager.Instance.CurrentTender.MaterialList; this.DataSource = IhalematikModelBase.GetModels <MaterialListModel, MaterialList>(items); this.TotalMarkupNonKDVPreview = this.DataSource.Sum(p => p.TotalFare); Tender currentTender = UICurrentManager.Instance.CurrentTender; IhalematikProBL.Entity.Rule provisionalBond = RuleProvider.Instance.GetItems("Code", "ProvisionalBond").FirstOrDefault(); IhalematikProBL.Entity.Rule completionBond = RuleProvider.Instance.GetItems("Code", "CompletionBond").FirstOrDefault(); IhalematikProBL.Entity.Rule tradingStamps = RuleProvider.Instance.GetItems("Code", "TradingStamps").FirstOrDefault(); double KDVTefkifat = 0; double carriage = double.Parse(string.IsNullOrEmpty(txtCarriage.Text) ? "0" : txtCarriage.Text.Replace("TL", string.Empty)); double accountingCosts = 0; if (currentTender.TenderType == TenderTypeEnum.DirectSupply) { accountingCosts = (this.TotalMarkupNonKDVPreview * SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(completionBond.Value) / 100); } else { KDVTefkifat = this.TotalMarkupNonKDVPreview * 0.18 / 10 * 3; accountingCosts = (this.TotalMarkupNonKDVPreview * SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(provisionalBond.Value) / 100) + (this.TotalMarkupNonKDVPreview * SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(completionBond.Value) / 100) + (this.TotalMarkupNonKDVPreview * SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(tradingStamps.Value) / 100) + KDVTefkifat; } double otherCosts = double.Parse(string.IsNullOrEmpty(txtOtherCoast.Text) ? "0" : txtOtherCoast.Text.Replace("TL", string.Empty)); currentTender.Carriage = carriage; currentTender.AccountingCosts = accountingCosts; this.OtherTotalAmount = accountingCosts + otherCosts; double increaseAmount = (this.OtherTotalAmount / this.TotalMarkupNonKDVPreview); double totalMarkupZeroCarriage = this.DataSource.Where(p => p.CarriagePercent == 0).Sum(p => p.TotalFare); double otherCarriageZeroAmountPercent = this.DataSource.Sum(p => p.CarriagePercent); double increaseZeroCarriage = (carriage * (100 - otherCarriageZeroAmountPercent) / 100 / totalMarkupZeroCarriage); double increaseCarriageAmount = (carriage / increaseZeroCarriage); if (carriage == 0) { increaseCarriageAmount = 0; } //birim fiyat unittotalFare //Toplam fiyat TotalFare this.TotalMarkupNonKDVPreview = 0; #region LeftPanelValues this.TotalMarkupNonKDVPreview = 0; double TotalMarkupNonKDV = 0; double materialCostAmount = 0; // Malzeme Maliyet fiyat double materialkdvTotalAmount = 0; // Malzeme Toplam KDV double totalAmount = 0; // Malzeme Toplam Fiyat double workerCostAmount = 0; // Malzeme Maliyet fiyat double totalRisk = 0; // RiskToplami; //Kar Toplamlari double markupMaterialAmount = 0; double markupWorkerAmount = 0; //Insan saat arac saat toplami double totalPersonHour = 0; double totalUnitPrice = 0; #endregion foreach (MaterialListModel item in this.DataSource) { double increaseOtherFare = 0; increaseOtherFare = ((increaseAmount * item.TotalFare) / item.Quantity); if (item.CarriagePercent == 0) { increaseOtherFare += ((increaseZeroCarriage * item.TotalFare) / item.Quantity); item.UnitTotalFarePreview = (item.UnitTotalFare + increaseOtherFare); } else { increaseOtherFare += (item.CarriagePercent * carriage / 100 / item.Quantity); item.UnitTotalFarePreview = (item.UnitTotalFare + increaseOtherFare); } this.TotalMarkupNonKDVPreview += item.TotalFarePreview; TotalMarkupNonKDV += item.TotalFare; materialCostAmount += item.PozOBFUnitPrice * item.Quantity; materialkdvTotalAmount += item.KDVAmount; workerCostAmount += item.CustomWorkerTotalAmount; markupMaterialAmount += item.UnitMarkup * item.Quantity;; markupWorkerAmount += item.TotalCustomWorkerMarkupPrice;// * (item.Markup / 100); totalPersonHour += Math.Round(item.TotalWorkerMarkup, 2); totalUnitPrice += Math.Round(item.TotalCustomWorkerMarkupPrice, 2); totalRisk += Math.Round(item.UnitRisk * item.Quantity, 2); } LoadingManager.Instance.Hide(); grdMaterialList.DataSource = null; grdMaterialList.DataSource = this.DataSource; #region LeftPanelValues totalAmount = materialCostAmount + materialkdvTotalAmount; txtMaterialCostAmount.Text = materialCostAmount.ToString("c2"); txtWorkerCostAmount.Text = workerCostAmount.ToString("c2"); txtAccountingCosts.Text = (accountingCosts - KDVTefkifat).ToString("c2"); txtKDVTefkifat.Text = KDVTefkifat.ToString("c2"); txtLeftPanelCarriage.Text = UICurrentManager.Instance.CurrentTender.Carriage.ToString("c2"); //double otherCost = double.Parse(txtLeftPanelOtherCoast.Text); txtTotalAmount.Text = (materialCostAmount + workerCostAmount + accountingCosts + UICurrentManager.Instance.CurrentTender.Carriage + this.OtherCost).ToString("c2"); double workerMarkupAmount = Math.Round((workerCostAmount * 18 / 100), 2); txtMarkupMaterialTotal.Text = markupMaterialAmount.ToString("c2"); txtMarkupWorkerAmount.Text = markupWorkerAmount.ToString("c2"); txtTotalRisk.Text = totalRisk.ToString("c2"); txtTotalMarkupAmount.Text = (markupMaterialAmount + markupWorkerAmount + totalRisk).ToString("c2"); txtMaterialkdvTotalAmount.Text = materialkdvTotalAmount.ToString("c2"); txtWorkerKDVAmount.Text = workerMarkupAmount.ToString("c2"); txtKDVToplam.Text = (materialkdvTotalAmount + workerMarkupAmount).ToString("c2"); //txtMarkupAmount.Text = (markupWorkerAmount + markupMaterialAmount).ToString("c2"); txtTotalPersonHour.Text = totalPersonHour.ToString("c2"); txtTotalUnitPrice.Text = totalUnitPrice.ToString("c2"); txtDifference.Text = Math.Round((totalPersonHour - totalUnitPrice), 2).ToString("c2"); lblTotalMarkupNonKDV.Text = this.TotalMarkupNonKDVPreview.ToString("c2"); //txtPanelMarkupMaterialTotal.Text = txtMarkupMaterialTotal.Text; // a.samet ekledi #endregion lblTotalMarkupNonKDV.Text = this.TotalMarkupNonKDVPreview.ToString("c2"); lblbeforeTotalMarkupNonKDV.Text = TotalMarkupNonKDV.ToString("c2"); TenderProvider.Instance.Save(currentTender); }
private void LoadMaterialListGridCalculate(List <MaterialListModel> DataSource) { LoadingManager.Instance.Show(this); Tender currentTender = UICurrentManager.Instance.CurrentJobberTender.Tender; this.TotalMarkupNonKDVPreview = DataSource.Sum(p => p.TotalFare); //Tender currentTender = UICurrentManager.Instance.CurrentTender; IhalematikProBL.Entity.Rule provisionalBond = RuleProvider.Instance.GetItems("Code", "ProvisionalBond").FirstOrDefault(); IhalematikProBL.Entity.Rule completionBond = RuleProvider.Instance.GetItems("Code", "CompletionBond").FirstOrDefault(); IhalematikProBL.Entity.Rule tradingStamps = RuleProvider.Instance.GetItems("Code", "TradingStamps").FirstOrDefault(); double KDVTefkifat = 0; double carriage = currentTender.Carriage; //double.Parse(string.IsNullOrEmpty(txtCarriage.Text) ? "0" : txtCarriage.Text.Replace("TL", string.Empty)); double accountingCosts = 0; if (currentTender.TenderType == TenderTypeEnum.DirectSupply) { accountingCosts = (this.TotalMarkupNonKDVPreview * SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(completionBond.Value) / 100); } else { KDVTefkifat = this.TotalMarkupNonKDVPreview * 0.18 / 10 * 3; accountingCosts = (this.TotalMarkupNonKDVPreview * SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(provisionalBond.Value) / 100) + (this.TotalMarkupNonKDVPreview * SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(completionBond.Value) / 100) + (this.TotalMarkupNonKDVPreview * SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(tradingStamps.Value) / 100) + KDVTefkifat; } List <OtherExpenses> otherExpenses = OtherExpensesProvider.Instance.GetItems("TenderId", currentTender.Id); this.OtherCost = otherExpenses.Sum(p => p.Price); double otherCosts = this.OtherCost; //double.Parse(string.IsNullOrEmpty(txtOtherCoast.Text) ? "0" : txtOtherCoast.Text.Replace("TL", string.Empty)); currentTender.Carriage = carriage; currentTender.AccountingCosts = accountingCosts; this.OtherTotalAmount = accountingCosts + otherCosts; double increaseAmount = (this.OtherTotalAmount / this.TotalMarkupNonKDVPreview); double totalMarkupZeroCarriage = DataSource.Where(p => p.CarriagePercent == 0).Sum(p => p.TotalFare); double otherCarriageZeroAmountPercent = DataSource.Sum(p => p.CarriagePercent); double increaseZeroCarriage = (carriage * (100 - otherCarriageZeroAmountPercent) / 100 / totalMarkupZeroCarriage); double increaseCarriageAmount = (carriage / increaseZeroCarriage); if (carriage == 0) { increaseCarriageAmount = 0; } foreach (MaterialListModel item in DataSource) { double increaseOtherFare = 0; increaseOtherFare = ((increaseAmount * item.TotalFare) / item.Quantity); if (item.CarriagePercent == 0) { increaseOtherFare += ((increaseZeroCarriage * item.TotalFare) / item.Quantity); item.UnitTotalFarePreview = (item.UnitTotalFare + increaseOtherFare); } else { increaseOtherFare += (item.CarriagePercent * carriage / 100 / item.Quantity); item.UnitTotalFarePreview = (item.UnitTotalFare + increaseOtherFare); } } LoadingManager.Instance.Hide(); grdMaterialList.DataSource = null; grdMaterialList.DataSource = DataSource.Where(p => p.TenderGroupId == this.SelectedGroupId).ToList(); }