public static List <Supplier_Invoice_Line_Replacement_DataType> build_po_invoiceline(LineInvoiceModelDTO lineobjdata, List <Supplier_Invoice_Line_Replacement_DataType> lineitem)
        {
            List <Audited_Accounting_WorktagObjectType> listworktagobj = new List <Audited_Accounting_WorktagObjectType>();
            Spend_CategoryObjectType catobjtype = new Spend_CategoryObjectType();

            // if(lineobjdata.Line_Cost_Center!=null)

            if (lineobjdata.Line_Cost_Center != null)
            {
                listworktagobj.Add(new Audited_Accounting_WorktagObjectType()
                {
                    ID = new List <Audited_Accounting_WorktagObjectIDType>()
                    {
                        new Audited_Accounting_WorktagObjectIDType
                        {
                            type  = "Cost_Center_Reference_ID",
                            Value = lineobjdata.Line_Cost_Center
                        }
                    }.ToArray()
                });
            }
            else
            {
                listworktagobj = null;
            }

            if (lineobjdata.Line_Spend_Category_ID != null)
            {
                catobjtype.ID = new Spend_CategoryObjectIDType[] { new Spend_CategoryObjectIDType {
                                                                       type = "Spend_Category_ID",

                                                                       Value = lineobjdata.Line_Spend_Category_ID
                                                                   } };
            }
            else
            {
                catobjtype = null;
            }


            Audited_Accounting_WorktagObjectType[] worktagobj2 =
                new Audited_Accounting_WorktagObjectType[] { new Audited_Accounting_WorktagObjectType {
                                                                 ID = new Audited_Accounting_WorktagObjectIDType[]
                                                                 {
                                                                     new Audited_Accounting_WorktagObjectIDType {
                                                                         type  = "Cost_Center_Reference_ID",
                                                                         Value = lineobjdata.Line_Cost_Center
                                                                     }, new Audited_Accounting_WorktagObjectIDType {
                                                                         type  = "Organization_Reference_ID",
                                                                         Value = "SIA-WAM Zaki Mohd"
                                                                     }, new Audited_Accounting_WorktagObjectIDType {
                                                                         type  = "Custom_Organization_Reference_ID",
                                                                         Value = "SIA-WAM Zaki Mohd"
                                                                     }
                                                                 }
                                                             } };

            Purchase_Order_LineObjectType PurchaseObj = new Purchase_Order_LineObjectType()
            {
                ID = new Purchase_Order_LineObjectIDType[] {
                    new Purchase_Order_LineObjectIDType
                    {
                        parent_type = "Document_Number",
                        parent_id   = "PO-0000019678",
                        Value       = "1",
                        type        = "Line_Number"
                    }
                },
                Descriptor = "somedes"
            };


            lineitem.Add(new Supplier_Invoice_Line_Replacement_DataType
            {
                Extended_Amount               = lineobjdata.Line_Extended_Amount,
                Quantity                      = 1,
                Unit_Cost                     = lineobjdata.Line_Extended_Amount,
                QuantitySpecified             = true,
                Unit_CostSpecified            = true,
                Spend_Category_Reference      = null,
                Purchase_Order_Line_Reference = PurchaseObj,
                Worktags_Reference            = null,
            });



            return(lineitem);
        }
        //Generate data for Non-PO Invoice
        public static List <Supplier_Invoice_Line_Replacement_DataType> build_NON_PO_invoiceline(List <Supplier_Invoice_Line_Replacement_DataType> Supplier_invoice_line_replacement_Line, LineInvoiceModelDTO InvoicemodelDTO)
        {
            List <Audited_Accounting_WorktagObjectType> listworktagobj = new List <Audited_Accounting_WorktagObjectType>();

            listworktagobj.Add(new Audited_Accounting_WorktagObjectType()
            {
                ID = new List <Audited_Accounting_WorktagObjectIDType>()
                {
                    new Audited_Accounting_WorktagObjectIDType
                    {
                        type  = "Cost_Center_Reference_ID",
                        Value = InvoicemodelDTO.Line_Cost_Center
                    },
                }.ToArray()
            });


            listworktagobj.Add(new Audited_Accounting_WorktagObjectType()
            {
                ID = new List <Audited_Accounting_WorktagObjectIDType>()
                {
                    new Audited_Accounting_WorktagObjectIDType
                    {
                        type  = "Custom_Organization_Reference_ID",
                        Value = InvoicemodelDTO.Line_Custom_Organization_Reference_ID
                    }
                }.ToArray()
            });
            if (!string.IsNullOrEmpty(InvoicemodelDTO.Line_Employee_ID))
            {
                listworktagobj.Add(new Audited_Accounting_WorktagObjectType()
                {
                    ID = new List <Audited_Accounting_WorktagObjectIDType>()
                    {
                        new Audited_Accounting_WorktagObjectIDType
                        {
                            type  = "Employee_ID",
                            Value = InvoicemodelDTO.Line_Employee_ID
                        }
                    }.ToArray()
                });
            }

            if (!string.IsNullOrEmpty(InvoicemodelDTO.Line_Project_ID))
            {
                listworktagobj.Add(new Audited_Accounting_WorktagObjectType()
                {
                    ID = new List <Audited_Accounting_WorktagObjectIDType>()
                    {
                        new Audited_Accounting_WorktagObjectIDType
                        {
                            type  = "Project_ID",
                            Value = InvoicemodelDTO.Line_Project_ID
                        }
                    }.ToArray()
                });
            }

            // projec

            Spend_CategoryObjectType catobjtype = new Spend_CategoryObjectType()
            {
                ID = new Spend_CategoryObjectIDType[] { new Spend_CategoryObjectIDType {
                                                            type  = "Spend_Category_ID",
                                                            Value = InvoicemodelDTO.Line_Spend_Category_ID
                                                        } }
            };



            Supplier_invoice_line_replacement_Line.Add(new Supplier_Invoice_Line_Replacement_DataType
            {
                Extended_Amount          = InvoicemodelDTO.Line_Extended_Amount,
                Spend_Category_Reference = catobjtype,
                Worktags_Reference       = listworktagobj.ToArray(),
                Item_Description         = InvoicemodelDTO.Line_Item_Description
            });

            return(Supplier_invoice_line_replacement_Line);
        }