Beispiel #1
0
        public WorkTaskModel(WorkTask workTask)
        {
            this.Number = workTask.WorkEffortNumber;

            this.Date             = (workTask.ThroughDate() ?? DateTime.UtcNow).ToString("yyyy-MM-dd");
            this.Purpose          = string.Join(", ", workTask.WorkEffortPurposes.Select(v => v.Name));
            this.Facility         = workTask.Facility?.Name;
            this.ContactName      = workTask.ContactPerson?.PartyName;
            this.ContactTelephone = workTask.ContactPerson?.CellPhoneNumber?.Description ?? workTask.ContactPerson?.GeneralPhoneNumber?.Description;

            if (workTask.ExistOrderItemFulfillment)
            {
                if (workTask.OrderItemFulfillment is SalesOrderItem salesOrderItem)
                {
                    var salesOrder = salesOrderItem.SalesOrderWhereSalesOrderItem;
                    this.PurchaseOrder = salesOrder?.OrderNumber;

                    if (salesOrderItem.ExistSalesTerms)
                    {
                        this.PaymentTerms = string.Join(", ", salesOrderItem.SalesTerms.Select(v => v.Description));
                    }
                    else if (salesOrder?.ExistSalesTerms == true)
                    {
                        this.PaymentTerms = string.Join(", ", salesOrder.SalesTerms.Select(v => v.Description));
                    }
                    else if (workTask.Customer?.PaymentNetDays() != null)
                    {
                        this.PaymentTerms = workTask.Customer.PaymentNetDays().ToString();
                    }
                }
            }
        }
Beispiel #2
0
        public WorkTaskModel(WorkTask workTask)
        {
            this.Number      = workTask.WorkEffortNumber;
            this.Name        = workTask.Name;
            this.Description = workTask.Description;
            this.WorkDone    = workTask.WorkDone;

            this.Date             = (workTask.ThroughDate() ?? workTask.Strategy.Session.Now()).ToString("yyyy-MM-dd");
            this.Purpose          = string.Join(", ", workTask.WorkEffortPurposes.Select(v => v.Name));
            this.Facility         = workTask.Facility?.Name;
            this.ContactName      = workTask.ContactPerson?.PartyName;
            this.ContactTelephone = workTask.ContactPerson?.CellPhoneNumber?.Description ?? workTask.ContactPerson?.GeneralPhoneNumber?.Description;

            this.TotalLabour = Math.Round(workTask.ServiceEntriesWhereWorkEffort.OfType <TimeEntry>()
                                          .Where(v => (v.IsBillable &&
                                                       !v.BillableAmountOfTime.HasValue && v.AmountOfTime.HasValue) || v.BillableAmountOfTime.HasValue)
                                          .Sum(v => v.BillingAmount), 2);

            this.TotalParts = Math.Round(workTask.WorkEffortInventoryAssignmentsWhereAssignment
                                         .Sum(v => v.Quantity * v.UnitSellingPrice), 2);

            this.TotalOther = Math.Round(workTask.WorkEffortPurchaseOrderItemAssignmentsWhereAssignment
                                         .Sum(v => v.Quantity * v.UnitSellingPrice), 2);

            this.Total = this.TotalLabour + this.TotalParts + this.TotalOther;

            if (workTask.ExistOrderItemFulfillment)
            {
                if (workTask.OrderItemFulfillment is SalesOrderItem salesOrderItem)
                {
                    var salesOrder = salesOrderItem.SalesOrderWhereSalesOrderItem;
                    this.PurchaseOrder = salesOrder?.OrderNumber;

                    if (salesOrderItem.ExistSalesTerms)
                    {
                        this.PaymentTerms = string.Join(", ", salesOrderItem.SalesTerms.Select(v => v.Description));
                    }
                    else if (salesOrder?.ExistSalesTerms == true)
                    {
                        this.PaymentTerms = string.Join(", ", salesOrder.SalesTerms.Select(v => v.Description));
                    }
                    else if (workTask.Customer?.PaymentNetDays() != null)
                    {
                        this.PaymentTerms = workTask.Customer.PaymentNetDays().ToString();
                    }
                }
            }
        }
Beispiel #3
0
        public WorkTaskModel(WorkTask workTask)
        {
            this.Number      = workTask.WorkEffortNumber;
            this.Name        = workTask.Name;
            this.Description = workTask.Description?.Split('\n');
            this.WorkDone    = workTask.WorkDone?.Split('\n');

            this.Date             = (workTask.ThroughDate() ?? workTask.Strategy.Session.Now()).ToString("yyyy-MM-dd");
            this.Purpose          = string.Join(", ", workTask.WorkEffortPurposes.Select(v => v.Name));
            this.Facility         = workTask.Facility?.Name;
            this.ContactName      = workTask.ContactPerson?.PartyName;
            this.ContactTelephone = workTask.ContactPerson?.CellPhoneNumber?.Description ?? workTask.ContactPerson?.GeneralPhoneNumber?.Description;

            this.TotalLabour = workTask.TotalLabourRevenue.ToString("N2", new CultureInfo("nl-BE"));

            this.TotalParts = workTask.TotalMaterialRevenue.ToString("N2", new CultureInfo("nl-BE"));

            this.TotalOther = workTask.TotalSubContractedRevenue.ToString("N2", new CultureInfo("nl-BE"));

            this.Total = workTask.GrandTotal.ToString("N2", new CultureInfo("nl-BE"));
        }