protected void MakeLineMaterialOperations(FmFinPlanDocLine line, FmFinPlanDocTime time) { FmJournalOperation oper = null; switch (line.LineType) { case FmFinPlanLineType.FMFPL_MATERIAL_TOP: break; case FmFinPlanLineType.FMFPL_MATERIAL_BAY: break; case FmFinPlanLineType.FMFPL_MATERIAL_BAY_ITEM_COST: break; case FmFinPlanLineType.FMFPL_MATERIAL_BAY_ITEM_PAY: break; case FmFinPlanLineType.FMFPL_MATERIAL_BAY_PAY: break; case FmFinPlanLineType.FMFPL_MATERIAL_BUILD: break; case FmFinPlanLineType.FMFPL_MATERIAL_BUILD_ITEM: break; } }
protected void OperationFill(FmFinPlanDocLine line, FmFinPlanDocTime time) { if (time.TimeType == FmFinPlanTimeType.FMFPT_TOTAL || time.SubTimes.Count != 0 || time.ValueManual == 0) { return; } // FmJournalOperation oper = os.CreateObject<FmJournalOperation>(); // doc.DocOperations.Add(oper); switch (line.Sheet) { case FmFinPlanSheetType.FMFPS_COST: MakeLineCostOperations(line, time); break; case FmFinPlanSheetType.FMFPS_CASH: MakeLineCashOperations(line, time); break; case FmFinPlanSheetType.FMFPS_PARTY: MakeLinePartyOperations(line, time); break; case FmFinPlanSheetType.FMFPS_MATERIAL: MakeLineMaterialOperations(line, time); break; case FmFinPlanSheetType.FMFPS_NORMATIV: break; default: break; } }
protected FmJournalOperation MakeOperation(FmFinPlanDocLine line, FmFinPlanDocTime time) { FmJournalOperation oper = ObjectSpace.CreateObject <FmJournalOperation>(); Document.DocOperations.Add(oper); OperationFillDate(oper, time); return(oper); }
protected void MakeLineCostOperations(FmFinPlanDocLine line, FmFinPlanDocTime time) { // FmJournalOperation oper = null; switch (line.LineType) { case FmFinPlanLineType.FMFPL_COST_SALE: break; // oper = MakeOperation(os, doc, line, time); // oper.DepartmentStructItem = // break; } }
protected void OperationFillDate(FmJournalOperation oper, FmFinPlanDocTime time) { switch (time.TimeType) { case FmFinPlanTimeType.FMFPT_YEAR: oper.Date = new DateTime(time.Year, 12, 31); break; case FmFinPlanTimeType.FMFPT_QUARTER: oper.Date = new DateTime(time.Year, time.Quarter * 3, 1).AddMonths(1).AddDays(-1); break; case FmFinPlanTimeType.FMFPT_MONTH: oper.Date = new DateTime(time.Year, time.Month, 1).AddMonths(1).AddDays(-1); break; default: oper.Date = new DateTime(1899, 12, 31); break; } }
protected void MakeLineCashOperations(FmFinPlanDocLine line, FmFinPlanDocTime time) { FmJournalOperation oper = null; switch (line.LineType) { case FmFinPlanLineType.FMFPL_CASH_IN_RUB_CASH: //oper = MakeOperation(line, time); //oper.FinAccountType = FinAccountType.ACC_O_PAY_SUPPLIER; //oper.FinOperationType = FinOperationType.CREDIT; //oper.FinAccountBalanceType = FinOperationType.CREDIT; //oper.CostItem = CostItems.FirstOrDefault(x => x.Code == "7001"); //oper.BalanceSumma = time.ValueManual; //oper.BalanceValuta = line.TopLine.Valuta; //oper.Party = line.TopLine.Party; //break; break; // oper = MakeOperation(os, doc, line, time); // oper.DepartmentStructItem = // break; } }
protected void MakeLinePartyOperations(FmFinPlanDocLine line, FmFinPlanDocTime time) { FmJournalOperation oper = null; switch (line.LineType) { case FmFinPlanLineType.FMFPL_PARTY_PARTY_RUB_COST: oper = MakeOperation(line, time); oper.FinAccountType = FinAccountType.ACC_O_PAY_SUPPLIER; oper.FinOperationType = FinOperationType.CREDIT; oper.FinAccountBalanceType = FinOperationType.CREDIT; oper.CostItem = CostItems.FirstOrDefault(x => x.Code == "7001"); oper.BalanceSumma = time.ValueManual; oper.BalanceValuta = line.TopLine.Valuta; oper.Party = line.TopLine.Party; break; case FmFinPlanLineType.FMFPL_PARTY_PARTY_RUB_PAY_POST: oper = MakeOperation(line, time); oper.FinAccountType = FinAccountType.ACC_O_PAY_SUPPLIER; oper.FinOperationType = FinOperationType.DEBET; oper.FinAccountBalanceType = FinOperationType.CREDIT; oper.CostItem = CostItems.FirstOrDefault(x => x.Code == "7001"); oper.BalanceSumma = time.ValueManual; oper.BalanceValuta = line.TopLine.TopLine.Valuta; oper.Party = line.TopLine.TopLine.Party; // oper = MakeOperation(line, time); oper.FinAccountType = FinAccountType.ACC_A_CASH; oper.FinOperationType = FinOperationType.CREDIT; oper.FinAccountBalanceType = FinOperationType.DEBET; oper.CostItem = CostItems.FirstOrDefault(x => x.Code == "7001"); oper.BalanceSumma = time.ValueManual; oper.BalanceValuta = line.TopLine.TopLine.Valuta; oper.PayType = PaymentRequest.fmPRPayType.POSTPAYMENT; oper.Party = line.TopLine.TopLine.Party; break; case FmFinPlanLineType.FMFPL_PARTY_PARTY_RUB_PAY_PRE: oper = MakeOperation(line, time); oper.FinAccountType = FinAccountType.ACC_A_PREPAY_SUPPLIER; oper.FinOperationType = FinOperationType.DEBET; oper.FinAccountBalanceType = FinOperationType.DEBET; oper.CostItem = CostItems.FirstOrDefault(x => x.Code == "7001"); oper.BalanceSumma = time.ValueManual; oper.BalanceValuta = line.TopLine.TopLine.Valuta; oper.Party = line.TopLine.TopLine.Party; // oper = MakeOperation(line, time); oper.FinAccountType = FinAccountType.ACC_A_CASH; oper.FinOperationType = FinOperationType.CREDIT; oper.FinAccountBalanceType = FinOperationType.DEBET; oper.CostItem = CostItems.FirstOrDefault(x => x.Code == "7001"); oper.BalanceSumma = time.ValueManual; oper.BalanceValuta = line.TopLine.TopLine.Valuta; oper.PayType = PaymentRequest.fmPRPayType.PREPAYMENT; oper.Party = line.TopLine.TopLine.Party; break; case FmFinPlanLineType.FMFPL_PARTY_PARTY_VAL_COST: oper = MakeOperation(line, time); oper.FinAccountType = FinAccountType.ACC_O_PAY_SUPPLIER; oper.FinOperationType = FinOperationType.CREDIT; oper.FinAccountBalanceType = FinOperationType.CREDIT; oper.CostItem = CostItems.FirstOrDefault(x => x.Code == "7001"); oper.ObligationSumma = time.ValueManual; oper.ObligationValuta = line.TopLine.Valuta; oper.Party = line.TopLine.Party; break; case FmFinPlanLineType.FMFPL_PARTY_PARTY_VAL_PAY_POST: oper = MakeOperation(line, time); oper.FinAccountType = FinAccountType.ACC_O_PAY_SUPPLIER; oper.FinOperationType = FinOperationType.DEBET; oper.FinAccountBalanceType = FinOperationType.CREDIT; oper.CostItem = CostItems.FirstOrDefault(x => x.Code == "7001"); oper.ObligationValuta = line.TopLine.TopLine.Valuta; oper.ObligationSumma = time.ValueManual; oper.Party = line.TopLine.TopLine.Party; // oper = MakeOperation(line, time); oper.FinAccountType = FinAccountType.ACC_A_CASH; oper.FinOperationType = FinOperationType.CREDIT; oper.FinAccountBalanceType = FinOperationType.DEBET; oper.CostItem = CostItems.FirstOrDefault(x => x.Code == "7001"); oper.ObligationValuta = line.TopLine.TopLine.Valuta; oper.ObligationSumma = time.ValueManual; oper.PayType = PaymentRequest.fmPRPayType.POSTPAYMENT; oper.Party = line.TopLine.TopLine.Party; break; case FmFinPlanLineType.FMFPL_PARTY_PARTY_VAL_PAY_PRE: oper = MakeOperation(line, time); oper.FinAccountType = FinAccountType.ACC_A_PREPAY_SUPPLIER; oper.FinOperationType = FinOperationType.DEBET; oper.FinAccountBalanceType = FinOperationType.DEBET; oper.CostItem = CostItems.FirstOrDefault(x => x.Code == "7001"); oper.ObligationValuta = line.TopLine.TopLine.Valuta; oper.ObligationSumma = time.ValueManual; oper.Party = line.TopLine.TopLine.Party; // oper = MakeOperation(line, time); oper.FinAccountType = FinAccountType.ACC_A_CASH; oper.FinOperationType = FinOperationType.CREDIT; oper.FinAccountBalanceType = FinOperationType.DEBET; oper.CostItem = CostItems.FirstOrDefault(x => x.Code == "7001"); oper.ObligationValuta = line.TopLine.TopLine.Valuta; oper.ObligationSumma = time.ValueManual; oper.PayType = PaymentRequest.fmPRPayType.PREPAYMENT; oper.Party = line.TopLine.TopLine.Party; break; } }
protected void LoadTimeCell(FmFinPlanDocLine line_doc, Int32 start_column, Int32 column, String type, String value) { Int16 year; Int16 quarter; Int16 month; Decimal value_decimal = 0; if (type != "Number") { return; } try { Double dval = Double.Parse(value, FormatProvider); value_decimal = Decimal.Round(new Decimal(dval), 5); } catch (FormatException e) { throw new FormatException(String.Format("Лист: {0}, Колонка: {1}/{2}, Строка: {3}, Значение {4}", line_doc.Sheet, start_column, column, line_doc.LineCode, value), e); } if (value_decimal == 0) { return; } if (start_column <= column && column <= start_column + 18) { if (column < start_column + 6) { year = BeginYear; month = (Int16)(column - start_column + 8); } else { year = (Int16)(BeginYear + 1); month = (Int16)(column - start_column - 5); } quarter = (Int16)((month - 1) / 3 + 1); if (month == 13) { quarter = 0; month = 0; } } else if (start_column + 19 <= column && column <= start_column + 63) { year = (Int16)((column - start_column - 19) / 5 + BeginYear + 2); quarter = (Int16)(column - start_column - 18 - (year - BeginYear - 2) * 5); if (quarter == 5) { quarter = 0; } month = 0; } else if (start_column + 64 == column) { year = 0; quarter = 0; month = 0; } else { return; } // System.Console.WriteLine(line_doc.LineCode + " {5} {0}/{1}/{2} {3}:'{4}'", year, quarter, month, type, value, column); FmFinPlanDocTime line_top = line_doc.LineTime; FmFinPlanDocTime line_year = null; FmFinPlanDocTime line_quarter = null; FmFinPlanDocTime line_month = null; FmFinPlanDocTime line_target = null; if (year != 0) { line_year = line_top.SubTimes.FirstOrDefault(x => x.Year == year); if (line_year == null) { line_year = ObjectSpace.CreateObject <FmFinPlanDocTime>(); line_top.SubTimes.Add(line_year); line_year.TimeTypeSet(FmFinPlanTimeType.FMFPT_YEAR); line_year.YearSet(year); } if (quarter != 0) { line_quarter = line_year.SubTimes.FirstOrDefault(x => x.Quarter == quarter); if (line_quarter == null) { line_quarter = ObjectSpace.CreateObject <FmFinPlanDocTime>(); line_year.SubTimes.Add(line_quarter); line_quarter.TimeTypeSet(FmFinPlanTimeType.FMFPT_QUARTER); line_quarter.YearSet(year); line_quarter.QuarterSet(quarter); } if (month != 0) { line_month = line_quarter.SubTimes.FirstOrDefault(x => x.Month == month); if (line_month == null) { line_month = ObjectSpace.CreateObject <FmFinPlanDocTime>(); line_quarter.SubTimes.Add(line_month); line_month.TimeTypeSet(FmFinPlanTimeType.FMFPT_MONTH); line_month.YearSet(year); line_month.QuarterSet(quarter); line_month.MonthSet(month); } line_target = line_month; } else { line_target = line_quarter; } } else { line_target = line_year; } } else { line_target = line_top; } line_target.ValueManual = value_decimal; }