Example #1
0
        public static SalesReceiptLine ToQBAccessSalesReceiptLine(this Line line)
        {
            var ineDetail = (line.AnyIntuitObject as SalesItemLineDetail) ?? new SalesItemLineDetail {
                Qty = 0, ItemRef = new ReferenceType()
                {
                    name = ""
                }
            };
            var qbAccessLine = new SalesReceiptLine
            {
                Id          = line.Id,
                Amount      = line.Amount,
                Description = line.Description,
                LineNum     = line.LineNum,
                Qty         = ineDetail.Qty,
                Sku         = ineDetail.ItemRef.name,
            };

            if (ineDetail.ItemElementName == ItemChoiceType.UnitPrice && (ineDetail.AnyIntuitObject is double))
            {
                qbAccessLine.UnitPrice = ( double )ineDetail.AnyIntuitObject;
            }

            return(qbAccessLine);
        }
Example #2
0
        public static Line ToIppPurchaseOrderLineItem(this QBInternalPurchaseOrdeLineItem qbInternalPurchaseOrdeLineItem)
        {
            var ippPurchaseOrderLineItem = new Line
            {
                Amount          = qbInternalPurchaseOrdeLineItem.Amount,
                AmountSpecified = true,
                Id      = qbInternalPurchaseOrdeLineItem.Id,
                LineNum = qbInternalPurchaseOrdeLineItem.LineNum,
            };

            var basedExpenseLineDetail = new ItemBasedExpenseLineDetail
            {
                Qty          = qbInternalPurchaseOrdeLineItem.Qty,
                QtySpecified = true,
            };

            basedExpenseLineDetail.ItemRef = new ReferenceType
            {
                name  = qbInternalPurchaseOrdeLineItem.ItemName,
                Value = qbInternalPurchaseOrdeLineItem.ItemValue,
            };

            ippPurchaseOrderLineItem.AnyIntuitObject = basedExpenseLineDetail;
            //ippPurchaseOrderLineItem.DetailType = LineDetailTypeEnum.PurchaseOrderItemLineDetail;
            ippPurchaseOrderLineItem.DetailType          = LineDetailTypeEnum.ItemBasedExpenseLineDetail;
            ippPurchaseOrderLineItem.DetailTypeSpecified = true;

            return(ippPurchaseOrderLineItem);
        }
Example #3
0
        public static Line ToIppPurchaseOrderLineItem(this PurchaseOrdeLineItem qbInternalPurchaseOrdeLineItem)
        {
            var basedExpenseLineDetail = new ItemBasedExpenseLineDetail
            {
                Qty          = qbInternalPurchaseOrdeLineItem.Qty,
                QtySpecified = true,
                ItemRef      = new ReferenceType
                {
                    name  = qbInternalPurchaseOrdeLineItem.ItemName,
                    Value = qbInternalPurchaseOrdeLineItem.ItemValue,
                },
                ItemElementName = ItemChoiceType.UnitPrice,
                AnyIntuitObject = qbInternalPurchaseOrdeLineItem.UnitPrice,
            };

            var ippPurchaseOrderLineItem = new Line
            {
                //Amount = qbInternalPurchaseOrdeLineItem.Amount,
                Amount          = qbInternalPurchaseOrdeLineItem.Qty * qbInternalPurchaseOrdeLineItem.UnitPrice,
                AmountSpecified = true,
                //Id = qbInternalPurchaseOrdeLineItem.Id,
                //LineNum = qbInternalPurchaseOrdeLineItem.LineNum,
            };

            ippPurchaseOrderLineItem.AnyIntuitObject     = basedExpenseLineDetail;
            ippPurchaseOrderLineItem.DetailType          = LineDetailTypeEnum.ItemBasedExpenseLineDetail;
            ippPurchaseOrderLineItem.DetailTypeSpecified = true;

            return(ippPurchaseOrderLineItem);
        }
Example #4
0
        public static Line ToIppInvoiceLine(this Models.Services.QuickBooksOnlineServicesSdk.CreateInvoice.Line line)
        {
            var ippInvoiceLine = new Line();

            var lineDetail = new SalesItemLineDetail()
            {
                Qty          = line.Qty,
                QtySpecified = true,
                ItemRef      = new ReferenceType()
                {
                    Value = line.ItemValue,
                    name  = line.ItemName
                },
                ItemElementName = ItemChoiceType.UnitPrice,
                AnyIntuitObject = line.UnitPrice,
            };

            ippInvoiceLine.AnyIntuitObject     = lineDetail;
            ippInvoiceLine.DetailType          = LineDetailTypeEnum.SalesItemLineDetail;
            ippInvoiceLine.DetailTypeSpecified = true;
            ippInvoiceLine.Amount          = line.UnitPrice * line.Qty;
            ippInvoiceLine.AmountSpecified = true;

            return(ippInvoiceLine);
        }
Example #5
0
        public static Models.Services.QuickBooksOnlineServicesSdk.GetPurchaseOrders.PurchaseOrdeLineItem ToQBServicePurchaseOrderLineItem(this Line line)
        {
            var ordeLineItem = new Models.Services.QuickBooksOnlineServicesSdk.GetPurchaseOrders.PurchaseOrdeLineItem
            {
                Amount  = line.Amount,
                Id      = line.Id,
                LineNum = line.LineNum,
            };

            var intuitObj = line.AnyIntuitObject as ItemBasedExpenseLineDetail;

            if (intuitObj != null)
            {
                ordeLineItem.Qty       = intuitObj.Qty;
                ordeLineItem.ItemName  = intuitObj.ItemRef.name;
                ordeLineItem.ItemValue = intuitObj.ItemRef.Value;
            }

            return(ordeLineItem);
        }
Example #6
0
        public static Models.Services.QuickBooksOnlineServicesSdk.GetPayments.Line ToQBAccessLine(this Line line)
        {
            var qbAccessLine = new Models.Services.QuickBooksOnlineServicesSdk.GetPayments.Line
            {
                Id          = line.Id,
                Amount      = line.Amount,
                Description = line.Description,
                LineNum     = line.LineNum,
            };

            return(qbAccessLine);
        }