public static void FilltmpLabourNormRow(LabourNorm itemLabourNorm) { DataRow rowTempLabourNorm = LabourNormDataTable.NewRow(); rowTempLabourNorm[0] = itemLabourNorm.ID; rowTempLabourNorm[1] = itemLabourNorm.InfDetID; rowTempLabourNorm[2] = itemLabourNorm.OperNum; rowTempLabourNorm[3] = itemLabourNorm.DepRegion; rowTempLabourNorm[4] = itemLabourNorm.ProfCode; rowTempLabourNorm[5] = itemLabourNorm.NameKindWork; rowTempLabourNorm[6] = itemLabourNorm.TariffNetNum; rowTempLabourNorm[7] = itemLabourNorm.KindPay; rowTempLabourNorm[8] = itemLabourNorm.WorkerRate; rowTempLabourNorm[9] = itemLabourNorm.ItemCTN; rowTempLabourNorm[10] = itemLabourNorm.PreparTimeCTN; rowTempLabourNorm[11] = itemLabourNorm.ItemPayNorm; rowTempLabourNorm[12] = itemLabourNorm.PreparTimePayNorm; rowTempLabourNorm[13] = itemLabourNorm.Valuation; rowTempLabourNorm[14] = itemLabourNorm.ValPreparTime; rowTempLabourNorm[15] = itemLabourNorm.CoeffCTN; rowTempLabourNorm[16] = itemLabourNorm.DocNum; rowTempLabourNorm[17] = itemLabourNorm.Date; rowTempLabourNorm[18] = itemLabourNorm.TaskNumber; LabourNormDataTable.Rows.Add(rowTempLabourNorm); }
private void ReCalcLabourNorm(double applyCoeff, LabourNorm inputLabourNorm) { double HourCost = _inftariff.Find(item => item.KindPay == inputLabourNorm.KindPay && item.TariffNetNum == inputLabourNorm.TariffNetNum && item.WorkerRate == inputLabourNorm.WorkerRate).HourCost; inputLabourNorm.ItemPayNorm = MathFunctionForSeries.ReCalcItemPayNorm(applyCoeff, inputLabourNorm.ItemCTN); inputLabourNorm.Valuation = MathFunctionForSeries.CalculateValuation(inputLabourNorm.ItemPayNorm, HourCost); inputLabourNorm.CoeffCTN = MathFunctionForSeries.CalculateCoeffCTN(inputLabourNorm.ItemPayNorm, 0, inputLabourNorm.ItemCTN, 0, 0); }
public void execute() { LabourNorm templb = FillTrudoyomkostDB.LabourNormList.Find(item => item.ID == _labourNormId); FillTrudoyomkostDB.LabourNormList.Remove(templb); var tempWhereUselist = FillTrudoyomkostDB.WhereOperationUseList.RemoveAll(item => item.LabourNormID == _labourNormId); FillTrudoyomkostDB.WhereOperationUseTableAdapter.DeleteQuery(_labourNormId); FillTrudoyomkostDB.LabourNormTableAdapter.DeleteQuery(_labourNormId); }
private static LabourNorm FillItemLabourNorm(ODLDB210410DataSet.TN148Row anrow) { int resultKOD_PROF = 0; byte tarifNetDefault = 2; LabourNorm labourNormItem = new LabourNorm(); if (anrow.IsKOD_PROFNull()) { labourNormItem.ProfCode = 0; } else if (anrow.KOD_PROF.Contains(',')) { labourNormItem.ProfCode = int.Parse(anrow.KOD_PROF.Split(',').First()); } else { int.TryParse(anrow.KOD_PROF.Trim(), out resultKOD_PROF); } labourNormItem.ProfCode = resultKOD_PROF; labourNormItem.InfDetID = (!DicDetNumAndId.ContainsKey(anrow.NDET) ? 0 : DicDetNumAndId[anrow.NDET]); labourNormItem.OperNum = (anrow.IsOPTNull() ? "" : anrow.OPT); if (anrow.IsUCHNull()) { labourNormItem.DepRegion = 0; } else { labourNormItem.DepRegion = anrow.UCH.Contains("ъ") || anrow.UCH.Contains("+") || anrow.UCH.First() == '0' || anrow.UCH.First() == ' ' || anrow.UCH.Last() == '-' || anrow.UCH.Last() == ',' ? 0 : double.Parse(anrow.UCH.Trim().Replace('.', ',').Replace('/', ',')); } labourNormItem.NameKindWork = anrow.IsNAIM_VIDA_RABNull() ? "" : anrow.NAIM_VIDA_RAB; labourNormItem.TariffNetNum = (anrow.IsTarifNull() || anrow.Tarif.Trim() == "") ? tarifNetDefault : byte.Parse(anrow.Tarif.Trim()); labourNormItem.KindPay = anrow.IsB1Null() ? "C" : anrow.B1; labourNormItem.WorkerRate = (anrow.IsRAZRNull() || anrow.RAZR.Equals("+") || anrow.RAZR.Trim() == "") ? 0 : double.Parse(anrow.RAZR.Replace(".", ",").Trim()); labourNormItem.ItemCTN = (anrow.IsPTN_SHTNull() ? 0 : double.Parse(anrow.PTN_SHT.ToString())); labourNormItem.PreparTimeCTN = (anrow.IsPTN_PZVNull() ? 0 : double.Parse(anrow.PTN_PZV.ToString())); labourNormItem.ItemPayNorm = (anrow.IsPLAT_SHTNull() ? 0 : double.Parse(anrow.PLAT_SHT.ToString())); labourNormItem.PreparTimePayNorm = (anrow.IsPLAT_PZVNull() ? 0 : double.Parse(anrow.PLAT_PZV.ToString())); labourNormItem.Valuation = (anrow.IsRASCENull() || anrow.RASCE == "0.00" || anrow.RASCE == "0.0" || anrow.RASCE.Trim() == "") ? 0 : double.Parse(anrow.RASCE); labourNormItem.ValPreparTime = (anrow.IsRASC_PZVNull() ? 0 : double.Parse(anrow.RASC_PZV.ToString())); labourNormItem.CoeffCTN = (anrow.IsPTNNull() ? 0 : double.Parse(anrow.PTN.ToString())); labourNormItem.DocNum = (anrow.IsN_DOKNull() ? "" : anrow.N_DOK); labourNormItem.Date = DateTime.Now; labourNormItem.TaskNumber = (anrow.IsN_zadanNull() ? "" : anrow.N_zadan); return(labourNormItem); }
public void execute() { foreach (var item in _infDetIdList) { int LabourId = FillTrudoyomkostDB.LabourNormList.Max().ID; ++LabourId; var whereOperationUseItems = FillTrudoyomkostDB.WhereOperationUseList.Where(wuItem => wuItem.LabourNormID == item); foreach (WhereOperationUse whereOperationUse in whereOperationUseItems.ToList()) { if (whereOperationUse.InfProductsChipher == ApplyWhereOpers.InfProductsChipher && whereOperationUse.SeriaFrom < ApplyWhereOpers.SeriaFrom && ApplyWhereOpers.SeriaFrom <= whereOperationUse.SeriaTo) { if (!_isNewLabourNormCreated) { var labourNorm = FillTrudoyomkostDB.LabourNormList.Find(labouritem => labouritem.ID == whereOperationUse.LabourNormID); if (labourNorm != null) { LabourNorm templabour = labourNorm.Copy(); templabour.ID = LabourId; if (ApplyCoeff > 0) { ReCalcLabourNorm(ApplyCoeff, templabour); } FillTrudoyomkostDB.LabourNormList.Add(templabour); FillTrudoyomkostDB.LabourNormTableAdapter.InsertQuery(templabour.InfDetID, templabour.OperNum, templabour.DepRegion, templabour.ProfCode, templabour.NameKindWork, templabour.TariffNetNum, templabour.KindPay, templabour.WorkerRate, templabour.ItemCTN, templabour.PreparTimeCTN, templabour.ItemPayNorm, templabour.PreparTimePayNorm, templabour.Valuation, templabour.ValPreparTime, templabour.CoeffCTN, templabour.DocNum, templabour.Date, templabour.TaskNumber); } FillTrudoyomkostDB.WhereOperationUseTableAdapter.InsertQuery(LabourId, ApplyWhereOpers.SeriaFrom, ApplyWhereOpers.SeriaTo, ApplyWhereOpers.InfProductsChipher); FillTrudoyomkostDB.WhereOperationUseList.Add(new WhereOperationUse(LabourId, ApplyWhereOpers.SeriaFrom, ApplyWhereOpers.SeriaTo, ApplyWhereOpers.InfProductsChipher)); _oldAndNewLabourId.Add(whereOperationUse.LabourNormID, LabourId); } else { FillTrudoyomkostDB.WhereOperationUseTableAdapter.InsertQuery(_oldAndNewLabourId[whereOperationUse.LabourNormID], ApplyWhereOpers.SeriaFrom, ApplyWhereOpers.SeriaTo, ApplyWhereOpers.InfProductsChipher); FillTrudoyomkostDB.WhereOperationUseList.Add(new WhereOperationUse(_oldAndNewLabourId[whereOperationUse.LabourNormID], ApplyWhereOpers.SeriaFrom, ApplyWhereOpers.SeriaTo, ApplyWhereOpers.InfProductsChipher)); } whereOperationUse.SeriaTo = ApplyWhereOpers.SeriaFrom - 1; FillTrudoyomkostDB.WhereOperationUseTableAdapter.UpdateSeriaTo(whereOperationUse.SeriaTo, whereOperationUse.InfProductsChipher, whereOperationUse.SeriaFrom, whereOperationUse.LabourNormID); } } } _isNewLabourNormCreated = true; }
private void FillLabourNormFromDg(DataGridView dgNorm, int currentRow, ref LabourNorm templabour) { templabour.TariffNetNum = Properties.Settings.Default.TariffNetNum; //сдесь ставится тариф!! templabour.ID = (int)dgNorm.Rows[currentRow].Cells[0].Value; templabour.InfDetID = (int)dgNorm.Rows[currentRow].Cells[1].Value; templabour.OperNum = dgNorm.Rows[currentRow].Cells[2].Value.ToString(); templabour.DepRegion = (double)dgNorm.Rows[currentRow].Cells[3].Value; templabour.ProfCode = (int)dgNorm.Rows[currentRow].Cells[4].Value; templabour.NameKindWork = dgNorm.Rows[currentRow].Cells[5].Value.ToString(); templabour.KindPay = dgNorm.Rows[currentRow].Cells[7].Value.ToString(); templabour.WorkerRate = (double)dgNorm.Rows[currentRow].Cells[8].Value; templabour.ItemCTN = (double)(Decimal)dgNorm.Rows[currentRow].Cells[9].Value; templabour.PreparTimeCTN = (double)(Decimal)dgNorm.Rows[currentRow].Cells[10].Value; templabour.ItemPayNorm = (double)(Decimal)dgNorm.Rows[currentRow].Cells[11].Value; templabour.PreparTimePayNorm = (double)(Decimal)dgNorm.Rows[currentRow].Cells[12].Value; templabour.CoeffCTN = (double)dgNorm.Rows[currentRow].Cells[15].Value; templabour.DocNum = dgNorm.Rows[currentRow].Cells[16].Value.ToString(); templabour.TaskNumber = dgNorm.Rows[currentRow].Cells[18].Value.ToString(); _dtOperApply = _parentForm.DcApplyOper[(int)dgNorm.Rows[currentRow].Cells[0].Value]; dgOperApply.DataSource = _dtOperApply; }
public static void AddRowToLabourDt(LabourNorm item, DataTable dttemp) { DataRow rowdttemp = dttemp.NewRow(); rowdttemp[0] = item.ID; rowdttemp[1] = item.InfDetID; rowdttemp[2] = item.OperNum; rowdttemp[3] = item.DepRegion; rowdttemp[8] = item.WorkerRate; rowdttemp[6] = item.TariffNetNum; rowdttemp[7] = item.KindPay; rowdttemp[4] = item.ProfCode; rowdttemp[5] = item.NameKindWork; rowdttemp[9] = item.ItemCTN; rowdttemp[10] = item.PreparTimeCTN; rowdttemp[11] = item.ItemPayNorm; rowdttemp[12] = item.PreparTimePayNorm; rowdttemp[13] = item.Valuation; rowdttemp[14] = item.ValPreparTime; rowdttemp[15] = item.CoeffCTN; rowdttemp[16] = item.DocNum; dttemp.Rows.Add(rowdttemp); }
public static void AddRowToLabourDt(LabourNorm item, DataTable dttemp) { DataRow rowdttemp = dttemp.NewRow(); rowdttemp[0] = item.ID; rowdttemp[1] = item.InfDetID; rowdttemp[2] = item.OperNum; rowdttemp[3] = item.DepRegion; rowdttemp[8] = item.WorkerRate; rowdttemp[6] = item.TariffNetNum; rowdttemp[7] = item.KindPay; rowdttemp[4] = item.ProfCode; rowdttemp[5] = item.NameKindWork; rowdttemp[9] = item.ItemCTN; rowdttemp[10] = item.PreparTimeCTN; rowdttemp[11] = item.ItemPayNorm; rowdttemp[12] = item.PreparTimePayNorm; rowdttemp[13] = item.Valuation; rowdttemp[14] = item.ValPreparTime; rowdttemp[15] = item.CoeffCTN; rowdttemp[16] = item.DocNum; dttemp.Rows.Add(rowdttemp); }
public static LabourNorm FillItemLabourNorm(ODLDB210410DataSet.TN158Row anrow) { byte tarifNetDefault = 2; int resultKOD_PROF = 0; LabourNorm labourNormItem = new LabourNorm(); labourNormItem.InfDetID = (!DicDetNumAndId.ContainsKey(anrow.NDET) ? 0 : DicDetNumAndId[anrow.NDET]); labourNormItem.OperNum = (anrow.IsOPTNull() ? "" : anrow.OPT); labourNormItem.DepRegion = (anrow.IsUCHNull() || !char.IsNumber(char.Parse(anrow.UCH.Substring(0, 1))) || anrow.UCH.Contains("+")) ? 0 : double.Parse(anrow.UCH.Trim().Replace('.', ',').Replace('/', ',').Replace("ъ", "").Replace("-", "")); if (anrow.IsKOD_PROFNull()) labourNormItem.ProfCode = 0; else if (anrow.KOD_PROF.Contains(',')) labourNormItem.ProfCode = int.Parse(anrow.KOD_PROF.Split(',').First()); else int.TryParse(anrow.KOD_PROF.Trim(), out resultKOD_PROF); labourNormItem.ProfCode = resultKOD_PROF; labourNormItem.NameKindWork = anrow.IsNAIM_VIDA_RABNull() ? "" : anrow.NAIM_VIDA_RAB; labourNormItem.TariffNetNum = (anrow.IsTarifNull() || anrow.Tarif.Trim() == "") ? tarifNetDefault : byte.Parse(anrow.Tarif.Trim()); labourNormItem.KindPay = anrow.IsB1Null() ? "C" : anrow.B1; labourNormItem.WorkerRate = (anrow.IsRAZRNull() || anrow.RAZR.Equals("+") || anrow.RAZR.Trim() == "") ? 0 : double.Parse(anrow.RAZR.Replace(".", ",").Trim()); labourNormItem.ItemCTN = (anrow.IsPTN_SHTNull() ? 0 : double.Parse(anrow.PTN_SHT.ToString())); labourNormItem.PreparTimeCTN = (anrow.IsPTN_PZVNull() ? 0 : double.Parse(anrow.PTN_PZV.ToString())); labourNormItem.ItemPayNorm = (anrow.IsPLAT_SHTNull() ? 0 : double.Parse(anrow.PLAT_SHT.ToString())); labourNormItem.PreparTimePayNorm = (anrow.IsPLAT_PZVNull() ? 0 : double.Parse(anrow.PLAT_PZV.ToString())); labourNormItem.Valuation = (anrow.IsRASCENull() || anrow.RASCE == "0.00" || anrow.RASCE == "0.0" || anrow.RASCE.Trim() == "") ? 0 : double.Parse(anrow.RASCE); labourNormItem.ValPreparTime = (anrow.IsRASC_PZVNull() ? 0 : double.Parse(anrow.RASC_PZV.ToString())); labourNormItem.CoeffCTN = (anrow.IsPTNNull() ? 0 : double.Parse(anrow.PTN.ToString())); labourNormItem.DocNum = (anrow.IsN_DOKNull() ? "" : anrow.N_DOK); labourNormItem.Date = DateTime.Now; labourNormItem.TaskNumber = (anrow.IsN_zadanNull() ? "" : anrow.N_zadan); return labourNormItem; }
public static void FilltmpLabourNormRow(LabourNorm itemLabourNorm) { DataRow rowTempLabourNorm = LabourNormDataTable.NewRow(); rowTempLabourNorm[0] = itemLabourNorm.ID; rowTempLabourNorm[1] = itemLabourNorm.InfDetID; rowTempLabourNorm[2] = itemLabourNorm.OperNum; rowTempLabourNorm[3] = itemLabourNorm.DepRegion; rowTempLabourNorm[4] = itemLabourNorm.ProfCode; rowTempLabourNorm[5] = itemLabourNorm.NameKindWork; rowTempLabourNorm[6] = itemLabourNorm.TariffNetNum; rowTempLabourNorm[7] = itemLabourNorm.KindPay; rowTempLabourNorm[8] = itemLabourNorm.WorkerRate; rowTempLabourNorm[9] = itemLabourNorm.ItemCTN; rowTempLabourNorm[10] = itemLabourNorm.PreparTimeCTN; rowTempLabourNorm[11] = itemLabourNorm.ItemPayNorm; rowTempLabourNorm[12] = itemLabourNorm.PreparTimePayNorm; rowTempLabourNorm[13] = itemLabourNorm.Valuation; rowTempLabourNorm[14] = itemLabourNorm.ValPreparTime; rowTempLabourNorm[15] = itemLabourNorm.CoeffCTN; rowTempLabourNorm[16] = itemLabourNorm.DocNum; rowTempLabourNorm[17] = itemLabourNorm.Date; rowTempLabourNorm[18] = itemLabourNorm.TaskNumber; LabourNormDataTable.Rows.Add(rowTempLabourNorm); }
private void ReCalcLabourNorm(double applyCoeff, LabourNorm inputLabourNorm) { double HourCost = _inftariff.Find(item => item.KindPay == inputLabourNorm.KindPay && item.TariffNetNum == inputLabourNorm.TariffNetNum && item.WorkerRate == inputLabourNorm.WorkerRate).HourCost; inputLabourNorm.ItemPayNorm = MathFunctionForSeries.ReCalcItemPayNorm(applyCoeff, inputLabourNorm.ItemCTN); inputLabourNorm.Valuation = MathFunctionForSeries.CalculateValuation(inputLabourNorm.ItemPayNorm, HourCost); inputLabourNorm.CoeffCTN = MathFunctionForSeries.CalculateCoeffCTN(inputLabourNorm.ItemPayNorm, 0, inputLabourNorm.ItemCTN, 0, 0); }
partial void DeleteLabourNorm(LabourNorm instance);
partial void UpdateLabourNorm(LabourNorm instance);
partial void InsertLabourNorm(LabourNorm instance);
public static void InsertFromTNTables() { InfDetDataTable.Clear(); using (var newLocalDb = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString)) { LinqQueryForTrudoyomkost.FillDictDetNumID(newLocalDb, ref DicDetNumAndId); LinqQueryForTrudoyomkost.FillDictDepIDCode(newLocalDb, ref DicDepCodeAndId); LinqQueryForTrudoyomkost.FillDictInfProfession(newLocalDb, ref DictInfProfession); } int whereOperUseId = 1; foreach (var item in Tn148DataTable) { if (DicDetNumAndId.ContainsKey(item.NDET)) { LabourNorm itemlabourNorm = FillItemLabourNorm(item); itemlabourNorm.ID = whereOperUseId; FilltmpLabourNormRow(itemlabourNorm); WhereOperationUse itemWhereOperUse = FillItemWhereOperationUse(item); itemWhereOperUse.LabourNormID = whereOperUseId; FilltmpWhereOperUseRow(itemWhereOperUse); ListAllLabourNorm.Add(item.NDET); whereOperUseId++; } } using (var newLocalDb = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString)) { LinqQueryForTrudoyomkost.FillDictDetNumID(newLocalDb, ref DicDetNumAndId); } DicCheckRepeatTN.Clear(); foreach (var item in Tn158DataTable) { if (DicDetNumAndId.ContainsKey(item.NDET)) { LabourNorm itemlabourNorm = FillItemLabourNorm(item); itemlabourNorm.ID = whereOperUseId; FilltmpLabourNormRow(itemlabourNorm); WhereOperationUse itemWhereOperUse = FillItemWhereOperationUse(item); itemWhereOperUse.LabourNormID = whereOperUseId; FilltmpWhereOperUseRow(itemWhereOperUse); ListAllLabourNorm.Add(item.NDET); whereOperUseId++; } } Properties.Settings.Default.Save(); SqlCeBulkCopy bulkInsert = new SqlCeBulkCopy(connString); DataTable tmptbLabourNorm = LabourNormDataTable; DataTable tmpWhereOperUse = WhereOperationUseDataTable; if (tmptbLabourNorm.Rows.Count > 0) { bulkInsert.DestinationTableName = "LabourNorm"; bulkInsert.WriteToServer(tmptbLabourNorm); } if (tmpWhereOperUse.Rows.Count > 0) { bulkInsert.DestinationTableName = "whereOperationUse"; bulkInsert.WriteToServer(tmpWhereOperUse); } LabourNormDataTable.Clear(); WhereOperationUseDataTable.Clear(); bulkInsert.Close(); }
public void UpdateItemPayNorm(ref LabourNorm laborNorm, bool timeInHour) { if (timeInHour) laborNorm.ItemPayNorm = double.Parse(vtbItemPayNorm.ValueTxt); else { laborNorm.ItemPayNorm = (double.Parse(vtbItemPayNorm.ValueTxt)) / 60; } }
private void btSaveAndLimit_Click(object sender, EventArgs e) { CheckValidateForm(gbOperItems); if (!IsValidForm) { MessageBox.Show(_isValidateGbNotific); IsValidForm = true; return; } using (var currentContext = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString)) { foreach (var item in _oldAndNewApplyDict) { WhereOperationUse tempItem = new WhereOperationUse(); tempItem = FillTrudoyomkostDB.WhereOperationUseList.ToList().Find(currItem => (currItem.SeriaFrom == item.Key.SeriaFrom && currItem.SeriaTo == item.Key.SeriaTo && currItem.InfProductsChipher == item.Key.ProductChipher && currItem.LabourNormID == templabour.ID)); tempItem.SeriaTo = item.Value.SeriaFrom - 1; FillTrudoyomkostDB.WhereOperationUseTableAdapter.UpdateSeriaTo(tempItem.SeriaTo, item.Key.ProductChipher, item.Key.SeriaFrom, templabour.ID); FillTrudoyomkostDB.WhereOperationUseList.Add(item.Value); currentContext.WhereOperationUse.InsertOnSubmit(item.Value); currentContext.SubmitChanges(); } templabour.ID = _newID; btSaveAndLimit.Enabled = false; UpdateLabourNorm(ref templabour, _timeInHour); FillTrudoyomkostDB.LabourNormTableAdapter.InsertQuery(templabour.InfDetID, templabour.OperNum, templabour.DepRegion, templabour.ProfCode, templabour.NameKindWork, templabour.TariffNetNum, templabour.KindPay, templabour.WorkerRate, templabour.ItemCTN, templabour.PreparTimeCTN, templabour.ItemPayNorm, templabour.PreparTimePayNorm, templabour.Valuation, templabour.ValPreparTime, templabour.CoeffCTN, templabour.DocNum, templabour.Date, templabour.TaskNumber); FillTrudoyomkostDB.LabourNormList.Add(templabour); templabour = new LabourNorm(); } _parentForm.UpdateDataGrids(); _newID++; btSaveAndLimit.Enabled = true; }
private void UpdateLabourNorm(ref LabourNorm labourNorm, bool timeInHour) { _shortProfInfo = _dcShortInfProf[vcbProfCode.SelectedItem.ToString()]; labourNorm.OperNum = vtbOperNum.ValueTxt; labourNorm.DepRegion = double.Parse(vtbDepRegion.ValueTxt); labourNorm.ProfCode = _shortProfInfo.ProfCode; labourNorm.NameKindWork = _shortProfInfo.NameKindWork; labourNorm.KindPay = cbKindPay.SelectedItem.ToString(); labourNorm.WorkerRate = double.Parse(vtbWorkRate.ValueTxt); if (timeInHour) { labourNorm.ItemCTN = double.Parse(vtbItemCTN.ValueTxt); labourNorm.PreparTimeCTN = double.Parse(vtbPreparTimeCTN.ValueTxt); labourNorm.ItemPayNorm = double.Parse(vtbItemPayNorm.ValueTxt); labourNorm.PreparTimePayNorm = double.Parse(vtbPreparTimePayNorm.ValueTxt); } else { labourNorm.ItemCTN = Math.Round(double.Parse(vtbItemCTN.ValueTxt) / 60, TrudoyomkostSettings.RoundNum); labourNorm.PreparTimeCTN = Math.Round(double.Parse(vtbPreparTimeCTN.ValueTxt) / 60, TrudoyomkostSettings.RoundNum); labourNorm.ItemPayNorm = Math.Round(double.Parse(vtbItemPayNorm.ValueTxt) / 60, TrudoyomkostSettings.RoundNum); labourNorm.PreparTimePayNorm = Math.Round(double.Parse(vtbPreparTimePayNorm.ValueTxt) / 60, TrudoyomkostSettings.RoundNum); } if (TrudoyomkostSettings.DepNum == 22 && labourNorm.ProfCode == 19433) labourNorm.ItemPayNorm = Math.Round((labourNorm.ItemPayNorm * 8) / 7.2, TrudoyomkostSettings.RoundNum); labourNorm.DocNum = cbDocNum.Text; labourNorm.Date = DateTime.Now; labourNorm.TaskNumber = vtbTaskNum.ValueTxt; _hourCost = _dcInfTariffInfo[ new InfTariffInfo(templabour.TariffNetNum, labourNorm.KindPay, labourNorm.WorkerRate)]; labourNorm.CoeffCTN = MathFunctionForSeries.CalculateCoeffCTN(labourNorm.ItemPayNorm, labourNorm.PreparTimePayNorm, labourNorm.ItemCTN, labourNorm.PreparTimeCTN, _countPerProduct); labourNorm.Valuation = MathFunctionForSeries.CalculateValuation(labourNorm.ItemPayNorm, _hourCost); labourNorm.ValPreparTime = MathFunctionForSeries.CalculateValPrepareTime(labourNorm.PreparTimePayNorm, _hourCost); }
private void FillLabourNormFromDg(DataGridView dgNorm, int currentRow, ref LabourNorm templabour) { templabour.TariffNetNum = Properties.Settings.Default.TariffNetNum; //сдесь ставится тариф!! templabour.ID = (int)dgNorm.Rows[currentRow].Cells[0].Value; templabour.InfDetID = (int)dgNorm.Rows[currentRow].Cells[1].Value; templabour.OperNum = dgNorm.Rows[currentRow].Cells[2].Value.ToString(); templabour.DepRegion = (double)dgNorm.Rows[currentRow].Cells[3].Value; templabour.ProfCode = (int)dgNorm.Rows[currentRow].Cells[4].Value; templabour.NameKindWork = dgNorm.Rows[currentRow].Cells[5].Value.ToString(); templabour.KindPay = dgNorm.Rows[currentRow].Cells[7].Value.ToString(); templabour.WorkerRate = (double)dgNorm.Rows[currentRow].Cells[8].Value; templabour.ItemCTN = (double)(Decimal)dgNorm.Rows[currentRow].Cells[9].Value; templabour.PreparTimeCTN = (double)(Decimal)dgNorm.Rows[currentRow].Cells[10].Value; templabour.ItemPayNorm = (double)(Decimal)dgNorm.Rows[currentRow].Cells[11].Value; templabour.PreparTimePayNorm = (double)(Decimal)dgNorm.Rows[currentRow].Cells[12].Value; templabour.CoeffCTN = (double)dgNorm.Rows[currentRow].Cells[15].Value; templabour.DocNum = dgNorm.Rows[currentRow].Cells[16].Value.ToString(); templabour.TaskNumber = dgNorm.Rows[currentRow].Cells[18].Value.ToString(); _dtOperApply = _parentForm.DcApplyOper[(int)dgNorm.Rows[currentRow].Cells[0].Value]; dgOperApply.DataSource = _dtOperApply; }