コード例 #1
0
        public override global::System.Data.DataSet Clone()
        {
            SalesorderItem cln = ((SalesorderItem)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
コード例 #2
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            SalesorderItem ds = new SalesorderItem();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
コード例 #3
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                SalesorderItem ds = new SalesorderItem();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "SalesorderItemDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
コード例 #4
0
        public void printSalesorder(dynamic salesorder)
        {
            MessageBox.Show(templateDir);
            string id           = salesorder["id"];
            string salesorderNo = "";

            if (salesorder["salesorder_no"] != null)
            {
                salesorderNo = salesorder["salesorder_no"];
            }
            string barcode = "";

            if (salesorder["salesorder_no"] != null)
            {
                barcode = '*' + salesorder["salesorder_no"] + '*';
            }
            string orderTime = "";

            if (salesorder["order_time"] != null)
            {
                orderTime = salesorder["order_time"];
            }

            /*
             * int orderYear = salesorder["order_year"];
             * int orderMonth = salesorder["order_month"];
             * int orderDay = salesorder["order_day"];
             * int orderHour = salesorder["order_hour"];
             * int orderMinute = salesorder["order_minute"];
             */
            float netAmount = salesorder["net_amount"];
            float amount    = salesorder["amount"];
            //float voucherDiscount = salesorder["voucher_discount_amount"];
            //float itemDiscount = salesorder["item_discount_amount"];
            //float discountAmount = salesorder["discount_amount"];
            float totalDiscountAmount = salesorder["total_discount_amount"];
            //float totalDiscountPercent = salesorder["total_discount_percent"];
            //float taxAmount = salesorder["tax_amount"];
            //float shipAmount = salesorder["ship_amount"];
            string cashier = salesorder["created_by_name"];

            string contactId = "";

            if (salesorder["contact_id"] != null)
            {
                contactId = salesorder["contact_id"];
            }
            string contactName = "";

            if (salesorder["contact_name"] != null)
            {
                contactName = salesorder["contact_name"];
            }

            List <SalesorderItem> items = new List <SalesorderItem>();

            foreach (var element in salesorder["items"])
            {
                SalesorderItem item = new SalesorderItem();
                item.id          = element["id"];
                item.item_id     = element["item_id"];
                item.item_name   = element["item_name"];
                item.list_price  = element["list_price"];
                item.quantity    = element["quantity"];
                item.net_amount  = element["net_amount"];
                item.amount      = element["amount"];
                item.discount    = element["discount"];
                item.tax_amount  = element["tax_amount"];
                item.tax_percent = element["tax_percent"];
                items.Add(item);
            }

            List <models.PaymentMethod> payments = new List <models.PaymentMethod>();

            foreach (var element in salesorder["payment_info"])
            {
                models.PaymentMethod pay = new models.PaymentMethod();
                pay.method      = element["method"];
                pay.name        = element["name"];
                pay.amount      = element["amount"];
                pay.currency_id = element["currency_id"];
                payments.Add(pay);
            }

            var cr = new ReportDocument();

            cr.Load(templateDir + "\\SalesorderTemplate.rpt");

            cr.SetDataSource(items);
            cr.SetParameterValue("order_time", orderTime);
            cr.SetParameterValue("saleorder_no", salesorderNo);
            cr.SetParameterValue("net_amount", netAmount);
            cr.SetParameterValue("total_discount_amount", totalDiscountAmount);
            cr.SetParameterValue("amount", amount);
            cr.SetParameterValue("cashier", cashier);
            cr.SetParameterValue("contact_name", contactName);
            cr.SetParameterValue("barcode", barcode);
            cr.SetParameterValue("workstation_name", "LalaMart Văn Phú");
            cr.SetParameterValue("address", "09LK13 KĐT mới Văn Phú, Phường Phú La, Hà Đông");
            cr.SetParameterValue("hotline", "1900112233");

            System.Drawing.Printing.PrinterSettings printSetings = new System.Drawing.Printing.PrinterSettings();
            System.Drawing.Printing.PageSettings    pageSetings  = new System.Drawing.Printing.PageSettings();
            //  Console.WriteLine("====================Printer_Name: " + salesorder["printer"]["name"]);
            printSetings.PrinterName = "SLK-TS100";
            cr.PrintToPrinter(printSetings, pageSetings, false);
            //cr.Refresh();
            cr.Clone();
            cr.Dispose();
        }