Exemplo n.º 1
0
        public App_Expense(JT_TransactionImportDetail importDetail, App_WorkTicket workTicket)
        {
            _id         = importDetail.ID;
            _workTicket = workTicket;
            if (_id == 0)
            {
                Date = System.DateTime.Now.Date;
            }
            else
            {
                Date = importDetail.TransactionDateAsDateTime;
            }
            Category = null;

            // dch rkl 12/09/2016 per Chris, use ItemCodeDesc
            //BillingDescription = importDetail.BillingDescription;
            BillingDescription = importDetail.ItemCodeDesc;

            ChargeCode             = importDetail.ItemCode;
            Quantity               = importDetail.QuantityUsed;
            UnitOfMeasure          = importDetail.UnitOfMeasure;
            UnitPrice              = importDetail.UnitPrice;
            UnitCost               = importDetail.UnitCost;
            IsReimbursable         = ((importDetail.ReimburseEmployee != null) && (importDetail.ReimburseEmployee.Trim().ToUpper() == "Y"));
            IsChargeableToCustomer = ((importDetail.ChargePart != null) && (importDetail.ChargePart.Trim().ToUpper() == "Y"));
        }
        /// <summary>
        /// Contstructor for repair part objects using the transaction import detail records.
        /// </summary>
        /// <param name="importDetail">The JT_TransactionImportDetail record to use.</param>
        /// <param name="workTicket">The App_WorkTicket object associated with this part.</param>
        public App_RepairPart(JT_TransactionImportDetail importDetail, App_WorkTicket workTicket)
        {
            _workTicket = workTicket;

            _id                      = importDetail.ID;
            _parentItemCode          = workTicket.DtlRepairItemCode;
            _partItemCode            = importDetail.ItemCode;
            _partItemCodeDescription = importDetail.ItemCodeDesc;
            _warehouse               = importDetail.WarehouseCode;
            _problemCode             = importDetail.ProblemCode;
            _quantity                = importDetail.QuantityUsed;
            _unitCost                = importDetail.UnitCost;
            _unitPrice               = importDetail.UnitPrice;
            _unitOfMeasure           = importDetail.UnitOfMeasure;
            _comment                 = importDetail.CommentText;
            _isChargeable            = (((importDetail.ChargePart != null) && (importDetail.ChargePart.Trim().ToUpper() == "Y")) ? true : false);
            _isPrintable             = (((importDetail.PrintPart != null) && (importDetail.PrintPart.Trim().ToUpper() == "Y")) ? true : false);
            _isPurchased             = (((importDetail.PurchasePart != null) && (importDetail.PurchasePart.Trim().ToUpper() == "Y")) ? true : false);
            _isOverhead              = (((importDetail.Overhead != null) && (importDetail.Overhead.Trim().ToUpper() == "Y")) ? true : false);
        }
        /// <summary>
        /// Contstructor for repair part objects using the transaction import detail records.
        /// </summary>
        /// <param name="importDetail">The JT_TransactionImportDetail record to use.</param>
        /// <param name="workTicket">The App_WorkTicket object associated with this part.</param>
        public App_RepairPart(JT_TransactionImportDetail importDetail, App_WorkTicket workTicket)
        {
            _ciOptions           = App.Database.GetCIOptions();
            quantityFormatString = String.Concat("{0:F", _ciOptions.NumberOfDecimalPlacesInQty, "}");
            umFormatString       = string.Concat("{0:F", _ciOptions.NumberOfDecimalPlacesInUM, "}");
            costFormatString     = string.Concat("{0:F", _ciOptions.NumberOfDecimalPlacesInCost, "}");
            priceFormatString    = string.Concat("{0:F", _ciOptions.NumberOfDecimalPlacesInPrice, "}");

            _workTicket = workTicket;

            _id                      = importDetail.ID;
            _parentItemCode          = workTicket.DtlRepairItemCode;
            _partItemCode            = importDetail.ItemCode;
            _partItemCodeDescription = importDetail.ItemCodeDesc;

            // dch rkl 11/22/2016
            CI_Item item = App.Database.GetItemFromDB(_partItemCode);

            if (_partItemCodeDescription == null)
            {
                if (item != null && item.ItemCodeDesc != null)
                {
                    _partItemCodeDescription = item.ItemCodeDesc;
                }
                else
                {
                    _partItemCodeDescription = "";
                }
            }

            // dch rkl 12/05/2016 Make sure part has a valuation value

            _warehouse     = importDetail.WarehouseCode;
            _problemCode   = importDetail.ProblemCode;
            _quantity      = importDetail.QuantityUsed;
            _unitCost      = importDetail.UnitCost;
            _unitPrice     = importDetail.UnitPrice;
            _unitOfMeasure = importDetail.UnitOfMeasure;
            _comment       = importDetail.CommentText;
            _lotSerialNo   = importDetail.LotSerialNo;
            _isChargeable  = (((importDetail.ChargePart != null) && (importDetail.ChargePart.Trim().ToUpper() == "Y")) ? true : false);
            _isPrintable   = (((importDetail.PrintPart != null) && (importDetail.PrintPart.Trim().ToUpper() == "Y")) ? true : false);
            _isPurchased   = (((importDetail.PurchasePart != null) && (importDetail.PurchasePart.Trim().ToUpper() == "Y")) ? true : false);
            _isOverhead    = (((importDetail.Overhead != null) && (importDetail.Overhead.Trim().ToUpper() == "Y")) ? true : false);

            // dch rkl 11/23/2016 Add Item Type
            if (item != null && item.ItemType != null)
            {
                _itemType = item.ItemType;
            }

            // dch rkl 12/05/2016 Add Item Valuation
            if (item != null && item.Valuation != null)
            {
                _valuation = item.Valuation;
            }

            // dch rkl 11/30/2016 add quantity required
            _quantityReqd = (decimal)importDetail.QuantityRequired;

            // dch rkl 12/05/2016 add qty shipped
            _quantityShipped = importDetail.QuantityCompleted;

            // dch rkl 01/13/2017 Add Extended Description
            if (importDetail.ItemCodeDesc != null)
            {
                _itemCodeDesc = importDetail.ItemCodeDesc;
            }
            else
            {
                _itemCodeDesc = "";
            }

            // dch rkl 01/23/2017 Sales Order Line Key
            _soLineKey = importDetail.SOLineKey;
        }