Skip to Content
0
Former Member
Dec 26, 2007 at 08:46 PM

sales order

15 Views

Hi Experts,

i have a text file in the following format

H01...

D01

D01

D01

H01

D01

H01

i have my code to create a sales order

for (int i = 0; i < lines.Length; i++)

{

line = lines<i>;

if (line.Substring(0, 3).Contains("H01"))

{

oSalesOrder.CardCode = line.Substring(26, 15).Trim()

oSalesOrder.NumAtCard = line.Substring(3, 9).Trim();

oSalesOrder.DocDueDate = Convert.ToDateTime("12/21/07");

oSalesOrder.TaxDate = Convert.ToDateTime("12/21/07");

}

if (line.Substring(0, 3).Contains("D01"))

{

oSalesOrder.Lines.ItemCode = line.Substring(22, 256).Trim();

oSalesOrder.Lines.Quantity = System.Convert.ToDouble(line.Substring(278, 20));

oSalesOrder.Lines.UnitPrice = System.Convert.ToDouble(line.Substring(298, 20));

oSalesOrder.Lines.Add();

}

else

{

i++;

}

result = oSalesOrder.Add();

if (result != 0)

{

System.Windows.Forms.MessageBox.Show(oCompany.GetLastErrorDescription());

}

else

{

System.Windows.Forms.MessageBox.Show("Sales Order added!");

}

}

I am not able to create a sales order for multiple detail records using this logic. could anyone advise me on the same.

Thanks and Regards,

Kreddy.