Exemple #1
0
        public DOXAPI.Document asDocument()
        {
            // Convert local class object to DOX-Pro document object
            DOXAPI.Document SupplierInvoiceDoc = new DOXAPI.Document();
            SupplierInvoiceDoc.DocType = SuppInvoiceDocType;
            // Set documents fields according to doc-type
            SupplierInvoiceDoc.Fields = new DOXAPI.Field[SuppInvoiceDocType.Attributes.Length];
            for (int i = 0; i < SupplierInvoiceDoc.Fields.Length; i++)
            {
                DOXAPI.Field f = new DOXAPI.Field();
                f.Attr = SuppInvoiceDocType.Attributes[i];
                System.Diagnostics.EventLog.WriteEntry("Supplier Invoice- as docoument", "f.Attr.Name: " + f.Attr.Name, System.Diagnostics.EventLogEntryType.Information);
                switch (f.Attr.Name)
                {
                case "Invoice No":
                    f.Value = invoiceNo;
                    break;

                case "Supplier No":
                    f.Value = SupplierID;
                    break;

                default:
                    f.Value = null;
                    break;
                }
                SupplierInvoiceDoc.Fields[i] = f;
            }

            SupplierInvoiceDoc.Title    = supplierID + "/" + invoiceNo;
            SupplierInvoiceDoc.FileName = filename;
            return(SupplierInvoiceDoc);
        }
Exemple #2
0
        public DOXAPI.Document asDocument()
        {
            // Convert local class object to DOX-Pro document object
            DOXAPI.Document docOrd99 = new DOXAPI.Document();
            docOrd99.DocType = flexOrder99Type;
            // Set documents fields according to doc-type
            docOrd99.Fields = new DOXAPI.Field[flexOrder99Type.Attributes.Length];
            for (int i = 0; i < docOrd99.Fields.Length; i++)
            {
                DOXAPI.Field f = new DOXAPI.Field();
                f.Attr = flexOrder99Type.Attributes[i];
                switch (f.Attr.Name)
                {
                case "Order99No":
                    f.Value = Order99No;
                    break;

                case "Supplier No":
                    f.Value = SupplierID;
                    break;

                default:
                    f.Value = null;
                    break;
                }
                docOrd99.Fields[i] = f;
            }


            docOrd99.Title    = supplierID + "/" + Order99No;
            docOrd99.FileName = filename;
            return(docOrd99);
        }
Exemple #3
0
        public DOXAPI.Document asDocument()
        {
            // Convert local class object to DOX-Pro document object
            DOXAPI.Document docPS = new DOXAPI.Document();
            docPS.DocType = flexPackingSlipType;
            // Set documents fields according to doc-type
            docPS.Fields = new DOXAPI.Field[flexPackingSlipType.Attributes.Length];
            for (int i = 0; i < docPS.Fields.Length; i++)
            {
                DOXAPI.Field f = new DOXAPI.Field();
                f.Attr = flexPackingSlipType.Attributes[i];
                switch (f.Attr.Name)
                {
                case "Packing Slip No":
                    f.Value = FullID;
                    break;

                case "Customer ID":
                    f.Value = Company + CustomerID;
                    break;

                case "Customer Order No":
                    f.Value = CustomerOrderNo;
                    break;

                case "Issue Date":
                    f.Value = IssueDate;
                    break;

                case "Items":
                    if (itemList.Length > 255)
                    {
                        f.Value = ItemList.Substring(0, 255);
                    }
                    else
                    {
                        f.Value = ItemList;
                    }
                    break;

                case "Return Date":
                    f.Value = DateTime.Now;
                    break;

                case "Invoice No":
                    f.Value = "";     // This item is set later
                    break;

                default:
                    f.Value = null;
                    break;
                }
                docPS.Fields[i] = f;
            }
            docPS.Title    = CustomerID + "/" + PackingSlipNo + "/" + DateTime.Now.ToShortDateString();
            docPS.FileName = filename;
            return(docPS);
        }
Exemple #4
0
        private static void FindInvoice(string company, string inv_no)
        {
            string token = null;

            DOXAPI.DocType           flexInvoiceType = null;
            DOXAPI.ServiceSoapClient dox             = new DOXAPI.ServiceSoapClient();       // Initialize web-service
            token = dox.Login("baanint", "fl3x8aan1n7", "Flex");
            if (token == null)
            {
                Console.WriteLine("Cannot login to DOXPRO");
                return;
            }
            Console.WriteLine("Login to DOXPRO succeeded, token is \"{0}\"", token);
            DOXAPI.DocType[] allTypes = dox.GetAllDocTypes(token);  // Get a list of doc-types from DOX-Pro
            // Find and keep the types used in this program
            foreach (DOXAPI.DocType dt in allTypes)
            {
                if (dt.Name == "Customer Invoice")
                {
                    flexInvoiceType = dox.GetDocType(token, dt.ID);
                    break;
                }
            }
            if (flexInvoiceType == null)
            {
                Console.WriteLine("Cannot obtain invoice DocType");
                return;
            }
            DOXAPI.SearchField[] fields = new DOXAPI.SearchField[1];

            DOXAPI.SearchField field = new DOXAPI.SearchField();
            field.FieldName  = "Invoice No";
            field.SearchType = DOXAPI.SearchTypes.StartWith;
            field.FieldValue = company + inv_no;
            fields[0]        = field;

            Console.WriteLine("Searching for Document in DOXPRO...");
            DOXAPI.TreeItemWithDocType[] invoices = dox.FindTreeItemWithDocType(token, fields, flexInvoiceType.DocTypeId);
            foreach (DOXAPI.TreeItemWithDocType ti in invoices)
            {
                // Fetch entity from result set
                DOXAPI.TreeItemWithDocType inv = dox.GetTreeItemWithDocType(token, ti);
                Console.WriteLine("Get Document ID={0}", inv.ID);
                DOXAPI.TreeItemWithDocType invFound = dox.GetTreeItemWithDocType(token, inv);
                DOXAPI.Document            doc      = invFound as DOXAPI.Document;
                if (doc != null)
                {
                    DOXAPI.Document foundDoc = dox.GetDocument(token, doc);
                    Console.WriteLine("FileName: {0}, FileName\"{1}\"", doc.FileName, foundDoc.FileName);
                }
                string url = dox.GetDocumentURL(token, inv.ID);
                Console.WriteLine("ID: {0}, url \"{1}\"", inv.ID, url);
            }
        }
Exemple #5
0
        public DOXAPI.Document asDocument()
        {
            // Convert local class object to DOX-Pro document object
            DOXAPI.Document ShipmentDoc = new DOXAPI.Document();
            ShipmentDoc.DocType = SuppShipmentDocType;
            // Set documents fields according to doc-type
            ShipmentDoc.Fields = new DOXAPI.Field[SuppShipmentDocType.Attributes.Length];
            for (int i = 0; i < ShipmentDoc.Fields.Length; i++)
            {
                DOXAPI.Field f = new DOXAPI.Field();
                f.Attr = SuppShipmentDocType.Attributes[i];
                System.Diagnostics.EventLog.WriteEntry("shipment- as docoument", "f.Attr.Name: " + f.Attr.Name, System.Diagnostics.EventLogEntryType.Information);
                switch (f.Attr.Name)
                {
                case "Shipment Doc No":
                    f.Value = ShippmentNo;
                    break;

                case "Supplier No":
                    f.Value = SupplierID;
                    break;

                //Ayala 13.04.2015
                case "Lot":
                    f.Value = LotNo;
                    break;

                case "Item No":
                    f.Value = Makat;
                    break;

                case "Date":
                    f.Value = DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss");
                    break;

                //End Ayala 13.04.2015
                default:
                    f.Value = null;
                    break;
                }
                ShipmentDoc.Fields[i] = f;
            }

            // ShipmentDoc.Title = supplierID + "/" + ShippmentNo;
            //Ayala 13.04.2015
            ShipmentDoc.Title = filenameWithoutExt;
            //End Ayala 13.04.2015
            ShipmentDoc.FileName = filename;
            return(ShipmentDoc);
        }
Exemple #6
0
        public DOXAPI.Document asDocument(string customerID, string customerName, string filename)
        {
            // Convert local class object to DOX-Pro document object
            DOXAPI.Document docInv = new DOXAPI.Document();
            docInv.DocType = flexInvoiceType;
            // Set documents fields according to doc-type
            docInv.Fields = new DOXAPI.Field[flexInvoiceType.Attributes.Length];
            for (int i = 0; i < docInv.Fields.Length; i++)
            {
                DOXAPI.Field f = new DOXAPI.Field();
                f.Attr = flexInvoiceType.Attributes[i];
                switch (f.Attr.Name)
                {
                case "Customer ID":
                    f.Value = customerID;
                    break;

                case "Invoice No":
                    f.Value = company + InvoiceNo;
                    break;

                case "Packing Slips":
                    f.Value = removeDuplicates(PackingSlips);
                    break;

                case "Issue Date":
                    f.Value = IssueDate;
                    break;

                default:
                    f.Value = null;
                    break;
                }
                docInv.Fields[i] = f;
            }
            docInv.Title    = InvoiceNo + "/" + IssueDate.ToShortDateString();
            docInv.FileName = filename;
            return(docInv);
        }