public static void InventoryReportCalculate(Guid companyUnitID, Guid itemID, int year, int month) { InventoryReportCalculate(companyUnitID, itemID, PeriodProvider.GetPeriod(year, month)); }
public static double ValuationCalculate(Guid itemID, int year, int month) { return(ValuationCalculate(itemID, PeriodProvider.GetPeriod(year, month))); }
public static double GetValuation(Guid itemID, int year, int month) { return(GetValuation(itemID, PeriodProvider.GetPeriod(year, month))); }
public static void PostBenifitCalculation(GLBenifitCalcsInfo mainObject) { if (mainObject.FK_GEPeriodID.HasValue == false || mainObject.GLBenifitCalcID == Guid.Empty) { return; } if (AccountingProvider.GetAccountID("911") == Guid.Empty) { return; } if (mainObject.FK_GLJournalVoucherID != Guid.Empty) { new GLJournalEntrysController().RealDeleteObjectsByFK("FK_GLJournalVoucherID", mainObject.FK_GLJournalVoucherID.Value); Guid iID = mainObject.FK_GLJournalVoucherID.Value; mainObject.FK_GLJournalVoucherID = null; new GLBenifitCalcsController().UpdateObject(mainObject); new GLJournalVouchersController().RealDeleteObject(iID); } DateTime startDate = PeriodProvider.GetFirstDay(mainObject.FK_GEPeriodID.Value); DateTime endDate = PeriodProvider.GetLastDay(mainObject.FK_GEPeriodID.Value); #region Voucher GLJournalVouchersController voucherCtrl = new GLJournalVouchersController(); GLJournalVouchersInfo voucher = new GLJournalVouchersInfo(); BusinessObjectHelper.CopyObject(mainObject, voucher, false); //voucher.FK_GLVoucherTypeID="BenifitCalc"; voucher.ERPVoucherID = mainObject.GLBenifitCalcID; voucher.ERPVoucherTableName = "GLBenifitCalcs"; voucher.JournalDate = endDate; voucher.ApprovalStatus = ABCCommon.ABCConstString.ApprovalTypeApproved; voucher.Remark = String.Format("Xác định kết quả kinh doanh tháng {0}/{1}", startDate.Month, startDate.Year); voucherCtrl.CreateObject(voucher); mainObject.FK_GLJournalVoucherID = voucher.GLJournalVoucherID; mainObject.ApprovalStatus = ABCCommon.ABCConstString.ApprovalTypeApproved; new GLBenifitCalcsController().UpdateObject(mainObject); #endregion Guid Acc911ID = AccountingProvider.GetAccountID("911"); GLJournalEntrysController entryCtrl = new GLJournalEntrysController(); List <GLJournalEntrysInfo> lstEntrys = new List <GLJournalEntrysInfo>(); String strRemark = String.Format(" tháng {0}/{1}", startDate.Month, startDate.Year); if (AccountingProvider.GetAccountID("511") != Guid.Empty) { lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("511"), Acc911ID, true, startDate, endDate, "", "Kết chuyển doanh thu thuần bán hàng" + strRemark)); } if (AccountingProvider.GetAccountID("512") != Guid.Empty) { lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("512"), Acc911ID, true, startDate, endDate, "", "Kết chuyển doanh thu thuần bán hàng nội bộ" + strRemark)); } if (AccountingProvider.GetAccountID("632") != Guid.Empty) { lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("632"), Acc911ID, true, startDate, endDate, "", "Kết chuyển giá vốn hàng bán" + strRemark)); } if (AccountingProvider.GetAccountID("515") != Guid.Empty) { lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("515"), Acc911ID, true, startDate, endDate, "", "Kết chuyển doanh thu hoạt động tài chính" + strRemark)); } if (AccountingProvider.GetAccountID("635") != Guid.Empty) { lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("635"), Acc911ID, true, startDate, endDate, "", "Kết chuyển chi phí tài chính" + strRemark)); } if (AccountingProvider.GetAccountID("641") != Guid.Empty) { lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("641"), Acc911ID, true, startDate, endDate, "", "Kết chuyển chi phí bán hàng" + strRemark)); } if (AccountingProvider.GetAccountID("642") != Guid.Empty) { lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("642"), Acc911ID, true, startDate, endDate, "", "Kết chuyển chi phí quản lý doanh nghiệp" + strRemark)); } if (AccountingProvider.GetAccountID("711") != Guid.Empty) { lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("711"), Acc911ID, true, startDate, endDate, "", "Kết chuyển thu nhập khác" + strRemark)); } if (AccountingProvider.GetAccountID("811") != Guid.Empty) { lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("811"), Acc911ID, true, startDate, endDate, "", "Kết chuyển chi phí khác" + strRemark)); } if (AccountingProvider.GetAccountID("8211") != Guid.Empty) { lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("8211"), Acc911ID, true, startDate, endDate, "", "Kết chuyển chi phí thuế TNDN phải nộp" + strRemark)); } if (AccountingProvider.GetAccountID("8212") != Guid.Empty) { lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("8212"), Acc911ID, true, startDate, endDate, "", "Kết chuyển chi phí thuế TNDN hoãn lại" + strRemark)); } foreach (GLJournalEntrysInfo entry in lstEntrys) { if (AccountForReCalcList.Contains(entry.FK_GLAccountID_Debit) == false) { AccountForReCalcList.Add(entry.FK_GLAccountID_Debit); } if (AccountForReCalcList.Contains(entry.FK_GLAccountID_Credit) == false) { AccountForReCalcList.Add(entry.FK_GLAccountID_Credit); } entry.FK_GLJournalVoucherID = voucher.GLJournalVoucherID; entry.JournalDate = endDate; entry.ApprovalStatus = ABCCommon.ABCConstString.ApprovalTypeApproved; entryCtrl.CreateObject(entry); } lstEntrys.Clear(); if (AccountingProvider.GetAccountID("4212") != Guid.Empty) { lstEntrys.AddRange(GenerateCloseEntrys(Acc911ID, AccountingProvider.GetAccountID("4212"), true, startDate, endDate, "", "Kết chuyển Lợi Nhuận" + strRemark)); } foreach (GLJournalEntrysInfo entry in lstEntrys) { if (AccountForReCalcList.Contains(entry.FK_GLAccountID_Debit) == false) { AccountForReCalcList.Add(entry.FK_GLAccountID_Debit); } if (AccountForReCalcList.Contains(entry.FK_GLAccountID_Credit) == false) { AccountForReCalcList.Add(entry.FK_GLAccountID_Credit); } entry.FK_GLJournalVoucherID = voucher.GLJournalVoucherID; entry.JournalDate = endDate; entry.ApprovalStatus = ABCCommon.ABCConstString.ApprovalTypeApproved; entryCtrl.CreateObject(entry); } BenifitCalculationOfPeriod(mainObject); }