protected override DocumentRecordsAggregate CreateRecordsByDocument(DocumentID documentId) { var resultRecords = new DocumentRecordsAggregate(); var taxTrans = TaxTransByRefNbr[documentId.RefNbr].OrderBy(taxTran => taxTran.RecordID); var lineNumber = 1; foreach (var taxTran in taxTrans) { if ((documentId.DocType == TaxAdjustmentType.AdjustInput && Taxes[taxTran.TaxID].ReverseTax != true) || (documentId.DocType == TaxAdjustmentType.AdjustOutput && Taxes[taxTran.TaxID].ReverseTax == true) || Taxes[taxTran.TaxID].TaxType == CSTaxType.Withholding) { var purchaseRecord = new PurchaseRecord(); _recordBuilderByTaxAdjustmentTaxTran.Build(purchaseRecord, _taxAdjustmentsByRefNbr[documentId.RefNbr], taxTran, lineNumber); resultRecords.PurchaseRecords.Add(purchaseRecord); } else { var supplyRecord = new SupplyRecord(); _recordBuilderByTaxAdjustmentTaxTran.Build(supplyRecord, _taxAdjustmentsByRefNbr[documentId.RefNbr], taxTran, lineNumber); resultRecords.SupplyRecords.Add(supplyRecord); } lineNumber++; } return(resultRecords); }
protected override DocumentRecordsAggregate CreateRecordsByDocument(DocumentID documentId) { var resultRecords = new DocumentRecordsAggregate(); var taxTranGroupsByLineRefNbr = TaxTransByRefNbr[documentId.RefNbr].OrderBy(taxTran => taxTran.RecordID) .GroupBy(taxTran => taxTran.LineRefNbr); foreach (var taxTranGroup in taxTranGroupsByLineRefNbr) { var lineNumber = 1; foreach (var taxTran in taxTranGroup) { var glTranWithCuryInfo = GetGLTranWithCuryInfo(taxTran); var glTran = (GLTran)glTranWithCuryInfo; var curyInfo = (CurrencyInfo)glTranWithCuryInfo; if ((taxTran.TaxType == CSTaxType.Use && Taxes[taxTran.TaxID].ReverseTax != true) || (taxTran.TaxType == CSTaxType.Sales && Taxes[taxTran.TaxID].ReverseTax == true) || Taxes[taxTran.TaxID].TaxType == CSTaxType.Withholding) { var purchaseRecord = new PurchaseRecord(); _recordBuilderByGLTranAndTaxTran.Build(purchaseRecord, glTran, curyInfo.CuryID, taxTran, lineNumber); ApplySign(purchaseRecord, taxTran.Module, taxTran.TranType); resultRecords.PurchaseRecords.Add(purchaseRecord); } else { var supplyRecord = new SupplyRecord(); _recordBuilderByGLTranAndTaxTran.Build(supplyRecord, glTran, curyInfo.CuryID, taxTran, lineNumber); ApplySign(supplyRecord, taxTran.Module, taxTran.TranType); resultRecords.SupplyRecords.Add(supplyRecord); } lineNumber++; } } return(resultRecords); }
public DocumentRecordsAggregate CreateGAFRecordsForDocumentGroup(DocumentIDGroup documentIDGroup, int?branchID, string taxPeriodID) { LoadData(documentIDGroup, branchID, taxPeriodID); var resultRecordsAggregate = new DocumentRecordsAggregate(); foreach (var refNbr in documentIDGroup.RefNbrs) { var documentId = new DocumentID() { Module = documentIDGroup.Module, RefNbr = refNbr }; var documentRecordsAggregate = CreateRecordsByDocument(documentId); resultRecordsAggregate.PurchaseRecords.AddRange(documentRecordsAggregate.PurchaseRecords); resultRecordsAggregate.SupplyRecords.AddRange(documentRecordsAggregate.SupplyRecords); } return(resultRecordsAggregate); }