Exemple #1
0
        public static TS810 CreateInvoice()
        {
            var result = new TS810
            {
                ST = new ST {
                    TransactionSetIdentifierCode_01 = "810", TransactionSetControlNumber_02 = "123456789"
                },
                BIG = new BIG
                {
                    InvoiceDate_01         = "20070129",
                    InvoiceNumber_02       = "0013833070",
                    PurchaseOrderDate_03   = "20070129",
                    PurchaseOrderNumber_04 = "V8748745",
                    TransactionTypeCode_07 = "DI"
                },
                NTE = new List <NTE>(),
                CAD = new CAD(),
                CTT = new CTT {
                    NumberofLineItems_01 = "", HashTotal_02 = ""
                }
            };

            var nte1 = new NTE {
                NoteReferenceCode_01 = "GEN", FreeFormMessage_02 = "Text1"
            };

            result.NTE.Add(nte1);
            var nte2 = new NTE {
                NoteReferenceCode_01 = "GEN", FreeFormMessage_02 = "Text2"
            };

            result.NTE.Add(nte2);

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// Build invoice.
        /// Original example from http://www.x12.org/examples/004010X348/basic-invoice/
        /// </summary>
        public static TS810 BuildInvoice(string controlNumber)
        {
            var result = new TS810();

            //  Indicates the start of an invoice transaction set and assigns a control number.
            result.ST = new ST();
            result.ST.TransactionSetIdentifierCode_01 = "810";
            result.ST.TransactionSetControlNumber_02  = controlNumber.PadLeft(9, '0');

            //  Indicates the invoice was created on May 13, 2000 and assigned invoice number SG427254.
            //  The invoice is in response to a purchase order sent on May 6, 2000 with purchase order number 508517 and release number 1001.
            result.BIG                        = new BIG();
            result.BIG.Date_01                = "20000513";
            result.BIG.InvoiceNumber_02       = "SG427254";
            result.BIG.Date_03                = "20000506";
            result.BIG.PurchaseOrderNumber_04 = "508517";
            result.BIG.ReleaseNumber_05       = "1001";

            //  Repeating N1 Loops
            result.N1Loop = new List <Loop_N1_810>();

            //  Begin N1 Loop
            var n1Loop = new Loop_N1_810();

            //  Indicates that the ship to party is ABC Aerospace Corporation. ABC's D-U-N-S+4 number is 123456789-0101.
            n1Loop.N1 = new N1();
            n1Loop.N1.EntityIdentifierCode_01 = "ST";
            n1Loop.N1.Name_02 = "ABC AEROSPACE CORPORATION";
            n1Loop.N1.IdentificationCodeQualifier_03 = "9";
            n1Loop.N1.IdentificationCode_04          = "123456789-0101";

            //  Repeating N3
            n1Loop.N3 = new List <N3>();

            //  The ship to party's street address is 1000 Boardwalk Drive.
            var n3 = new N3();

            n3.AddressInformation_01 = "1000 BOARDWALK DRIVE";
            n1Loop.N3.Add(n3);

            //  The ship to party's city, state, and ZIP is Somewhere, CA 98898.
            n1Loop.N4                        = new N4();
            n1Loop.N4.CityName_01            = "SOMEWHERE";
            n1Loop.N4.StateorProvinceCode_02 = "CA";
            n1Loop.N4.PostalCode_03          = "98898";

            //  End N1 Loop
            result.N1Loop.Add(n1Loop);

            //  Repeating ITD
            result.ITD = new List <ITD>();

            //  Indicates that discounts are not applicable, the terms period is the invoice date, and the net days due is 30 days using an electronic payment system.
            var itd = new ITD();

            itd.TermsTypeCode_01      = "05";
            itd.TermsBasisDateCode_02 = "3";
            itd.TermsNetDays_07       = "30";
            itd.PaymentMethodCode_14  = "E";
            result.ITD.Add(itd);

            //  Repeating IT1 Loops
            result.IT1Loop = new List <Loop_IT1_810>();

            //  Begin IT1 Loop
            var it1Loop = new Loop_IT1_810();

            //  Indicates that the purchase order's line number was 1. The invoice is for 48 units costing $3.00 each for manufacturer's part number R5656-2.
            it1Loop.IT1 = new IT1();
            it1Loop.IT1.AssignedIdentification_01        = "1";
            it1Loop.IT1.QuantityInvoiced_02              = "48";
            it1Loop.IT1.UnitorBasisforMeasurementCode_03 = "EA";
            it1Loop.IT1.UnitPrice_04 = "3";
            it1Loop.IT1.ProductServiceIDQualifier_06 = "MG";
            it1Loop.IT1.ProductServiceID_07          = "R5656-2";

            //  End IT1 Loop
            result.IT1Loop.Add(it1Loop);

            //  Indicates that the total invoice amount is $144.00.
            result.TDS           = new TDS();
            result.TDS.Amount_01 = "14400";

            //  Indicates that the invoice contained 1 line item.
            result.CTT = new CTT();
            result.CTT.NumberofLineItems_01 = "1";

            return(result);
        }
Exemple #3
0
 private static void ProcessInvoice(ISA isa, GS gs, TS810 invoice)
 {
     //  Do something with the invoice
 }
Exemple #4
0
        /// <summary>
        /// Sample invoice
        /// </summary>
        static TS810 CreateInvoice(string controlNumber)
        {
            var result = new TS810();

            result.ST = new ST();
            result.ST.TransactionSetIdentifierCode_01 = "810";
            result.ST.TransactionSetControlNumber_02  = controlNumber.PadLeft(9, '0');

            result.BIG                        = new BIG();
            result.BIG.Date_01                = DateTime.Now.ToString("yyyyMMdd");
            result.BIG.InvoiceNumber_02       = "123456789";
            result.BIG.Date_03                = "20030627";
            result.BIG.PurchaseOrderNumber_04 = "201177";

            result.REF = new List <REF>();

            var ref1 = new REF();

            ref1.ReferenceIdentificationQualifier_01 = "DP";
            ref1.ReferenceIdentification_02          = "123";
            result.REF.Add(ref1);

            var ref2 = new REF();

            ref2.ReferenceIdentificationQualifier_01 = "IA";
            ref2.ReferenceIdentification_02          = "456";
            result.REF.Add(ref2);

            result.N1Loop1 = new List <TS810_N1Loop1>();
            var n1Loop = new TS810_N1Loop1();

            n1Loop.N1 = new N1();
            n1Loop.N1.EntityIdentifierCode_01        = "ST";
            n1Loop.N1.IdentificationCodeQualifier_03 = "18";
            n1Loop.N1.IdentificationCode_04          = "123";

            result.N1Loop1.Add(n1Loop);

            result.ITD = new List <ITD>();
            var itd = new ITD();

            itd.TermsTypeCode_01        = "01";
            itd.TermsBasisDateCode_02   = "3";
            itd.TermsDiscountDaysDue_05 = "0";
            itd.TermsNetDays_07         = "45";

            result.IT1Loop1 = new List <TS810_IT1Loop1>();
            var it1Loop = new TS810_IT1Loop1();

            it1Loop.IT1 = new IT1();
            it1Loop.IT1.AssignedIdentification_01        = "1";
            it1Loop.IT1.QuantityInvoiced_02              = "2";
            it1Loop.IT1.UnitorBasisforMeasurementCode_03 = "EA";
            it1Loop.IT1.UnitPrice_04 = "120.6";
            it1Loop.IT1.ProductServiceIDQualifier_06 = "UP";
            it1Loop.IT1.ProductServiceID_07          = "123456789";

            result.IT1Loop1.Add(it1Loop);

            result.TDS           = new TDS();
            result.TDS.Amount_01 = "24012";

            result.CAD            = new CAD();
            result.CAD.Routing_05 = "1234";
            result.CAD.ReferenceIdentificationQualifier_07 = "BM";
            result.CAD.ReferenceIdentification_08          = "9999";

            result.CTT = new CTT();
            result.CTT.NumberofLineItems_01 = "1";

            return(result);
        }