Merhabalar sql de 2 tablom var 1 tabloyadan verileri çekiyorum 2 ci tabloya yazdırıyorum
ama söyle sorum var TRCODE göre ayırıp onun bilgilerini nasıl alabilirim
Ekli dosyayı görüntüle 232543
ama söyle sorum var TRCODE göre ayırıp onun bilgilerini nasıl alabilirim
Ekli dosyayı görüntüle 232543
C:
Sub add_order()
Dim sql As String = ("Select * from LG_991_01_ORFLINE_TABLO")
Dim cmd As New SqlCommand(sql, conn)
Dim sa As New SqlDataAdapter(cmd)
sa.Fill(ds)
DataGridView2.DataSource = ds.Tables(0)
Dim order = uapp.NewDataObject(UnityObjects.DataObjectType.doSalesOrderSlip)
order.New()
order.DataFields.FieldByName("NUMBER").Value = "~"
order.DataFields.FieldByName("DATE").Value = "24.11.2021"
order.DataFields.FieldByName("DOC_NUMBER").Value = "WEB"
order.DataFields.FieldByName("AUXIL_CODE").Value = "WEB"
order.DataFields.FieldByName("ARP_CODE").Value = CLIENTREF
order.DataFields.FieldByName("ORDER_STATUS").Value = 4
order.DataFields.FieldByName("CURRSEL_TOTAL").Value = 1
Dim transactions_lines = order.DataFields.FieldByName("TRANSACTIONS").Lines
For i = 0 To ds.Tables(0).Rows.Count - 1
Dim CLIENTREF = Replace(ds.Tables(0).Rows(i).Item("CLIENTREF"), " ", "")
Dim STOCKREF = Replace(ds.Tables(0).Rows(i).Item("STOCKREF"), " ", "")
Dim PRICE = ds.Tables(0).Rows(i).Item("PRICE")
transactions_lines.AppendLine()
transactions_lines((0)).FieldByName("TYPE").Value = 0
transactions_lines((transactions_lines.Count - 1)).FieldByName("MASTER_CODE").Value = STOCKREF
transactions_lines((transactions_lines.Count - 1)).FieldByName("QUANTITY").Value = 1
transactions_lines((transactions_lines.Count - 1)).FieldByName("PRICE").Value = PRICE
transactions_lines((transactions_lines.Count - 1)).FieldByName("VAT_RATE").Value = 18
transactions_lines((transactions_lines.Count - 1)).FieldByName("UNIT_CODE").Value = "ADET"
transactions_lines((transactions_lines.Count - 1)).FieldByName("UNIT_CONV1").Value = 1
transactions_lines((transactions_lines.Count - 1)).FieldByName("UNIT_CONV2").Value = 1
transactions_lines((transactions_lines.Count - 1)).FieldByName("DUE_DATE").Value = "24.11.2021 "
transactions_lines((transactions_lines.Count - 1)).FieldByName("MULTI_ADD_TAX").Value = 0
transactions_lines((transactions_lines.Count - 1)).FieldByName("EDT_CURR").Value = 1
transactions_lines((transactions_lines.Count - 1)).FieldByName("ORG_DUE_DATE").Value = "24.11.2021"
transactions_lines((transactions_lines.Count - 1)).FieldByName("ORG_QUANTITY").Value = 1
transactions_lines((transactions_lines.Count - 1)).FieldByName("ORG_PRICE").Value = PRICE
order.DataFields.FieldByName("AFFECT_RISK").Value = 0
order.DataFields.FieldByName("DEDUCTIONPART1").Value = 2
order.DataFields.FieldByName("DEDUCTIONPART2").Value = 3
order.DataFields.FieldByName("AFFECT_RISK").Value = 0
order.DataFields.FieldByName("DEDUCTIONPART1").Value = 2
order.DataFields.FieldByName("DEDUCTIONPART2").Value = 3
Next
If (order.Post() = True) Then
MsgBox("POST OK !")
End If
If order.ErrorCode <> 0 Then
MsgBox("DB Error:(" + CStr(order.ErrorCode) + ") - " + order.ErrorDesc)
Else
If order.ValidateErrors.Count > 0 Then
For i = 0 To order.ValidateErrors.Count - 1
MsgBox("XML Error :(" + CStr(order.ValidateErrors.Item(i).ID) + ")-" + order.ValidateErrors.Item(i).Error)
Next i
End If
End If
End Sub