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);
        }
예제 #2
0
        public async Task <Status.MessageType> PostDoubleKeyFieldAsync(string identifier, string identifier1, string updated, string user)
        {
            var obj    = JObject.Parse(updated);
            var oName  = "";
            var oValue = "";

            var temp = identifier.Split('|');

            foreach (var id in temp)
            {
                foreach (var property in obj.Properties())
                {
                    oName  = property.Name;
                    oValue = property.Value.ToString();

                    try
                    {
                        var entity = await _context.SupplyRecord
                                     .FirstOrDefaultAsync(x => x.ValueName == oName && x.Identifier == id)
                                     .ConfigureAwait(false);

                        if (entity != null)
                        {
                            entity.Data         = oValue;
                            entity.ModifiedDate = DateTime.Now;
                            entity.ModifiedBy   = user;

                            _context.SupplyRecord.Update(entity);
                            await _context.SaveChangesAsync().ConfigureAwait(false);
                        }
                        else
                        {
                            entity = new SupplyRecord
                            {
                                Identifier   = id,
                                ValueName    = oName,
                                Data         = oValue,
                                ModifiedDate = DateTime.Now,
                                ModifiedBy   = user,
                                CreatedDate  = DateTime.Now,
                                CreatedBy    = user
                            };

                            _context.SupplyRecord.Add(entity);
                            await _context.SaveChangesAsync().ConfigureAwait(false);
                        }
                        await new HistoryLogic(_context).LogHistory(id, oName, oValue, user, Status.Method.Update);
                    }
                    catch (Exception ex)
                    {
                        _Logger.Error(ex);
                        return(Status.MessageType.FAILED);
                    }
                }
            }

            return(Status.MessageType.SUCCESS);
        }
        public void Build(SupplyRecord supplyRecord, TExtendedInvoice extendedInvoice)
        {
            var saleCountryID = GetSaleCountryID(extendedInvoice);

            if (saleCountryID != MalaysiaCountryCode)
            {
                var country = GafRepository.GetCountry(saleCountryID);

                supplyRecord.Country = country.Description;
            }
        }
예제 #4
0
        public void WriteSupplyRecord(SupplyRecord supplyRecord, StringBuilder stringBuilder)
        {
            var dataListToWrite = BuildDocumentRecordsDataListToWrite(supplyRecord);

            dataListToWrite.Add(0, "S");
            dataListToWrite.Add(10, supplyRecord.CustomerName);
            dataListToWrite.Add(20, supplyRecord.CustomerBRN);
            dataListToWrite.Add(110, supplyRecord.Country);

            Write(stringBuilder, dataListToWrite.Values);
        }
예제 #5
0
        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);
        }