Exemple #1
0
        public SPBDto(UnitPaymentOrder element, List <UnitPaymentOrderDetail> spbDetails, List <UnitPaymentOrderItem> spbItems, List <UnitReceiptNoteItem> unitReceiptNoteItems, List <UnitReceiptNote> unitReceiptNotes)
        {
            Id   = element.Id;
            No   = element.UPONo;
            Date = element.Date;



            Supplier = new SupplierDto(element);
            Division = new DivisionDto(element.DivisionCode, element.DivisionId, element.DivisionName);

            UseVat       = element.UseVat;
            UseIncomeTax = element.UseIncomeTax;
            IncomeTax    = new IncomeTaxDto(element.IncomeTaxId, element.IncomeTaxName, element.IncomeTaxRate);
            IncomeTaxBy  = element.IncomeTaxBy;

            //var selectedSPBDetails = spbDetails.Where(detail =)
            var selectedSPBItems   = spbItems.Where(item => item.UPOId == element.Id).ToList();
            var selectedSPBItemIds = selectedSPBItems.Select(item => item.Id).ToList();
            var selectedSPBDetails = spbDetails.Where(detail => selectedSPBItemIds.Contains(detail.UPOItemId)).ToList();


            UnitCosts = selectedSPBDetails.Select(detail => new UnitCostDto(detail, selectedSPBItems, unitReceiptNoteItems, unitReceiptNotes, element)).ToList();
            Amount    = selectedSPBDetails.Sum(detail => detail.PriceTotal);
        }
Exemple #2
0
        public SPBDto(GarmentInternNote element, List <GarmentInvoice> invoices, List <GarmentInternNoteItem> internNoteItems, List <GarmentInternNoteDetail> internNoteDetails)
        {
            Id   = element.Id;
            No   = element.INNo;
            Date = element.INDate;

            var invoiceIds     = element.Items.Select(item => item.InvoiceId).ToList();
            var elementInvoice = invoices.FirstOrDefault(entity => invoiceIds.Contains(entity.Id));


            Supplier = new SupplierDto(element);


            if (elementInvoice != null)
            {
                Division     = new DivisionDto("", "0", "GARMENT");
                UseVat       = elementInvoice.UseVat;
                UseIncomeTax = elementInvoice.UseIncomeTax;
                IncomeTax    = new IncomeTaxDto(elementInvoice.IncomeTaxId, elementInvoice.IncomeTaxName, elementInvoice.IncomeTaxRate);
                IncomeTaxBy  = elementInvoice.IsPayTax ? "Dan Liris" : "Supplier";
            }

            var selectedInternNoteItems   = internNoteItems.Where(item => item.GarmentINId == element.Id).ToList();
            var selectedInternNoteItemIds = selectedInternNoteItems.Select(item => item.Id).ToList();
            var selectedInternNoteDetails = internNoteDetails.Where(detail => selectedInternNoteItemIds.Contains(detail.GarmentItemINId)).ToList();

            UnitCosts = selectedInternNoteDetails.Select(detail => new UnitCostDto(detail, selectedInternNoteItems, element, elementInvoice)).ToList();
            Amount    = selectedInternNoteDetails.Sum(detail => detail.PriceTotal);
        }
        public SPBDto(UnitPaymentOrder element, List <UnitPaymentOrderDetail> spbDetails, List <UnitPaymentOrderItem> spbItems, List <UnitReceiptNoteItem> unitReceiptNoteItems, List <UnitReceiptNote> unitReceiptNotes)
        {
            Id   = element.Id;
            No   = element.UPONo;
            Date = element.Date;


            Supplier = new SupplierDto(element);
            Division = new DivisionDto(element.DivisionCode, element.DivisionId, element.DivisionName);

            UseVat       = element.UseVat;
            UseIncomeTax = element.UseIncomeTax;
            IncomeTax    = new IncomeTaxDto(element.IncomeTaxId, element.IncomeTaxName, element.IncomeTaxRate);
            IncomeTaxBy  = element.IncomeTaxBy;

            //var selectedSPBDetails = spbDetails.Where(detail =)
            var selectedSPBItems   = spbItems.Where(item => item.UPOId == element.Id).ToList();
            var selectedSPBItemIds = selectedSPBItems.Select(item => item.Id).ToList();
            var selectedSPBDetails = spbDetails.Where(detail => selectedSPBItemIds.Contains(detail.UPOItemId)).ToList();


            UnitCosts = selectedSPBDetails.Select(detail => new UnitCostDto(detail, selectedSPBItems, unitReceiptNoteItems, unitReceiptNotes, element)).ToList();
            //Amount = selectedSPBDetails.Sum(detail => detail.PriceTotal);
            Amount = selectedSPBDetails.Sum(detail => {
                var quantity = detail.ReceiptQuantity;
                if (detail.QuantityCorrection > 0)
                {
                    quantity = detail.QuantityCorrection;
                }

                var price = detail.PricePerDealUnit;
                if (detail.PricePerDealUnitCorrection > 0)
                {
                    price = detail.PricePerDealUnitCorrection;
                }

                var result = quantity * price;
                if (detail.PriceTotalCorrection > 0)
                {
                    result = detail.PriceTotalCorrection;
                }

                var total = result;

                /*if (element != null)
                 * {
                 *  if (element.UseVat)
                 *  {
                 *      result += total * 0.1;
                 *  }
                 *
                 *  if (element.UseIncomeTax && (element.IncomeTaxBy == "Supplier" || element.IncomeTaxBy == "SUPPLIER"))
                 *  {
                 *      result -= total * (element.IncomeTaxRate / 100);
                 *  }
                 * }*/

                return(result);
            });
        }
 public SPBDtoItem(UnitPaymentOrder element, UnitPaymentOrderItem item)
 {
     Date         = element.Date;
     Remark       = element.Remark;
     Amount       = item.Details.Sum(detail => detail.PricePerDealUnit);
     UseVat       = element.UseVat;
     UseIncomeTax = element.UseIncomeTax;
     IncomeTax    = new IncomeTaxDto(element.IncomeTaxId, element.IncomeTaxName, element.IncomeTaxRate);
     IncomeTaxBy  = element.IncomeTaxBy;
 }
 public POExternalItemDto(GarmentExternalPurchaseOrderItem element, GarmentExternalPurchaseOrder entity, GarmentInternalPurchaseOrder purchaseOrder)
 {
     Product         = new ProductDto(element.ProductCode, element.ProductId, element.ProductName, element.DefaultUomId, element.DefaultUomUnit);
     DefaultQuantity = element.DefaultQuantity;
     DealQuantity    = element.DealQuantity;
     DealUOM         = new UOMDto(element.DealUomId, element.DealUomUnit);
     Conversion      = element.Conversion;
     Price           = element.PricePerDealUnit;
     UseVat          = entity.IsUseVat;
     Unit            = new UnitDto(purchaseOrder.UnitId, purchaseOrder.UnitCode, purchaseOrder.UnitName, purchaseOrder.DivisionCode, purchaseOrder.DivisionId, purchaseOrder.DivisionName);
     IncomeTax       = new IncomeTaxDto(entity.IncomeTaxId, entity.IncomeTaxName, entity.IncomeTaxRate);
     UseIncomeTax    = entity.IsIncomeTax;
     EPOId           = (int)entity.Id;
 }
Exemple #6
0
        public SPBDto(UnitPaymentOrder element)
        {
            Id   = element.Id;
            No   = element.UPONo;
            Date = element.Date;

            Amount = element.Items.SelectMany(item => item.Details).Sum(detail => detail.PriceTotal);

            UseVat       = element.UseVat;
            UseIncomeTax = element.UseIncomeTax;
            IncomeTax    = new IncomeTaxDto(element.IncomeTaxId, element.IncomeTaxName, element.IncomeTaxRate);
            IncomeTaxBy  = element.IncomeTaxBy;

            UnitCosts = new List <UnitCostDto>();
        }
 public POExternalItemDto(ExternalPurchaseOrderDetail element, ExternalPurchaseOrder entity)
 {
     Product         = new ProductDto(element.ProductCode, element.ProductId, element.ProductName, element.DefaultUomId, element.DefaultUomUnit);
     DefaultQuantity = element.DefaultQuantity;
     DealQuantity    = element.DealQuantity;
     DealUOM         = new UOMDto(element.DealUomId, element.DealUomUnit);
     Conversion      = element.Conversion;
     Price           = element.PricePerDealUnit;
     UseVat          = entity.UseVat;
     VatTax          = new VatTaxDto(entity.VatId, entity.VatRate);
     Unit            = new UnitDto(entity.UnitId, entity.UnitCode, entity.UnitName, entity.DivisionCode, entity.DivisionId, entity.DivisionName);
     IncomeTax       = new IncomeTaxDto(entity.IncomeTaxId, entity.IncomeTaxName, entity.IncomeTaxRate);
     IncomeTaxBy     = entity.IncomeTaxBy;
     UseIncomeTax    = entity.UseIncomeTax;
     EPOId           = (int)entity.Id;
 }
Exemple #8
0
        public SPBDto(GarmentInternNote element, List <GarmentInvoice> invoices)
        {
            Id   = element.Id;
            No   = element.INNo;
            Date = element.INDate;

            var invoiceIds     = element.Items.Select(item => item.InvoiceId).ToList();
            var elementInvoice = invoices.FirstOrDefault(entity => invoiceIds.Contains(entity.Id));

            Amount = element.Items.SelectMany(item => item.Details).Sum(detail => detail.PriceTotal);

            if (elementInvoice != null)
            {
                UseVat       = elementInvoice.UseVat;
                UseIncomeTax = elementInvoice.UseIncomeTax;
                IncomeTax    = new IncomeTaxDto(elementInvoice.IncomeTaxId, elementInvoice.IncomeTaxName, elementInvoice.IncomeTaxRate);
                IncomeTaxBy  = elementInvoice.IsPayTax ? "Dan Liris" : "Supplier";
            }
        }