Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21192

Passing values to crystal reports

$
0
0
Hi


I am having a list view having all the data after executing the query


SqlStr = "Select distinct INVOICE.RemovalNatureCode, TAXESNDUTIESREMOVALNATURE.RemovalNatureDescription " _
& " From INVOICE, TAXESNDUTIESREMOVALNATURE " _
& " Where TAXESNDUTIESREMOVALNATURE.RemovalNatureCode=INVOICE.RemovalNatureCode " _
& " And TAXESNDUTIESREMOVALNATURE.IsActive=1 " _
& " And month(INVOICE.InvoiceDate)='" & Month(dtpReturnMonth) & "' " _
& " And year(INVOICE.InvoiceDate)='" & Year(dtpReturnMonth) & "' " _
& " Order by TAXESNDUTIESREMOVALNATURE.RemovalNatureDescription"
rs.Open SqlStr, CN, adOpenKeyset, adLockReadOnly

If rs.RecordCount <> 0 Then
Do While Not rs.EOF

With lvwDutyPayable.ListItems.Add(, , "")
.SubItems(1) = rs.Fields("RemovalNatureDescription")
.ListSubItems(1).Bold = True
End With

SqlStr = "Select INVOICE.TarrifHeadNumber, INVOICE.ExcemptionNumber, INVOICE.ExcemptionNotificationSerialNo, CETSH.GoodsDescription, " _
& " sum(INVOICE.BasicValue * INVOICE.ExchangeRate) as AssValue " _
& " From INVOICE, CETSH " _
& " Where cast(CETSH.CETSHNumber as varchar)=INVOICE.TarrifHeadNumber " _
& " And INVOICE.RemovalNatureCode=" & rs.Fields("RemovalNatureCode") _
& " And month(INVOICE.InvoiceDate)='" & Month(dtpReturnMonth) & "' And year(INVOICE.InvoiceDate)='" & Year(dtpReturnMonth) & "' " _
& " And INVOICE.BranchCode=" & cpBraCode _
& " Group by INVOICE.TarrifHeadNumber, INVOICE.ExcemptionNumber, INVOICE.ExcemptionNotificationSerialNo, CETSH.GoodsDescription " _
& " Order by INVOICE.TarrifHeadNumber"
rsRe.Open SqlStr, CN, adOpenKeyset, adLockReadOnly

If rsRe.RecordCount <> 0 Then
Do While Not rsRe.EOF

varASValue = rsRe.Fields("AssValue")
varPFValue = 0

SqlStr = "Select INVOICECHARGES.ChargesValue * INVOICE.ExchangeRate as PFValue " _
& " From INVOICE, INVOICECHARGES " _
& " Where INVOICECHARGES.InvoiceNumber=INVOICE.InvoiceNumber " _
& " And INVOICECHARGES.FinYearCode=INVOICE.FinYearCode " _
& " And INVOICECHARGES.BranchCode=INVOICE.BranchCode " _
& " And INVOICECHARGES.ChargesCode=1 " _
& " And INVOICE.RemovalNatureCode=" & rs.Fields("RemovalNatureCode") _
& " And month(INVOICE.InvoiceDate)='" & Month(dtpReturnMonth) & "' " _
& " And year(INVOICE.InvoiceDate)= '" & Year(dtpReturnMonth) & "' " _
& " And INVOICE.TarrifHeadNumber='" & rsRe.Fields("TarrifHeadNumber") & "'"
rsTx.Open SqlStr, CN, adOpenKeyset, adLockReadOnly

If rsTx.RecordCount <> 0 Then
Do While Not rsTx.EOF
varPFValue = varPFValue + rsTx.Fields("PFValue")
rsTx.MoveNext
Loop
End If
rsTx.Close


varASValue = varASValue + varPFValue

SqlStr = "Select sum(INVOICEITEMS.ItemQuantity) as SumQuantity " _
& " From INVOICE, INVOICEITEMS " _
& " Where INVOICEITEMS.InvoiceNumber=INVOICE.InvoiceNumber " _
& " And INVOICEITEMS.FinYearCode=INVOICE.FinYearCode " _
& " And INVOICEITEMS.BranchCode=INVOICE.BranchCode " _
& " And INVOICE.RemovalNatureCode=" & rs.Fields("RemovalNatureCode") _
& " And month(INVOICE.InvoiceDate)='" & Month(dtpReturnMonth) & "' And year(INVOICE.InvoiceDate)='" & Year(dtpReturnMonth) & "' " _
& " And INVOICE.TarrifHeadNumber='" & rsRe.Fields("TarrifHeadNumber") & "' " _
& " And INVOICE.BranchCode=" & cpBraCode
rsTx.Open SqlStr, CN, adOpenKeyset, adLockReadOnly

If Not IsNull(rsTx.Fields("SumQuantity")) Then
varInvQty = rsTx.Fields("SumQuantity")
End If
rsTx.Close

SqlStr = "Select Top 1 CHARGESMASTER.ChargesPercentage as DutyPercentage " _
& " From INVOICE, INVOICECHARGES, CHARGESMASTER " _
& " Where CHARGESMASTER.ChargesCode=INVOICECHARGES.ChargesCode " _
& " And CHARGESMASTER.DutyHeadCode=16 " _
& " And INVOICECHARGES.InvoiceNumber=INVOICE.InvoiceNumber " _
& " And INVOICECHARGES.FinYearCode=INVOICE.FinYearCode " _
& " And INVOICECHARGES.BranchCode=INVOICE.BranchCode " _
& " And INVOICE.RemovalNatureCode= " & rs.Fields("RemovalNatureCode") _
& " And INVOICE.TarrifHeadNumber='" & rsRe.Fields("TarrifHeadNumber") & "' " _
& " And month(INVOICE.InvoiceDate)='" & Month(dtpReturnMonth) & "' And year(INVOICE.InvoiceDate)='" & Year(dtpReturnMonth) & "'" _
& " And INVOICE.BranchCode=" & cpBraCode
rsTx.Open SqlStr, CN, adOpenKeyset, adLockReadOnly

If rsTx.RecordCount <> 0 Then
varDutyPercent = rsTx.Fields("DutyPercentage")
End If
rsTx.Close

SqlStr = "Select sum(INVOICECHARGES.CHARGESVALUE) as DutyValue " _
& " From INVOICE, INVOICECHARGES, CHARGESMASTER " _
& " Where CHARGESMASTER.ChargesCode=INVOICECHARGES.ChargesCode " _
& " And CHARGESMASTER.DutyHeadCode=16 " _
& " And INVOICECHARGES.InvoiceNumber=INVOICE.InvoiceNumber " _
& " And INVOICECHARGES.FinYearCode=INVOICE.FinYearCode " _
& " And INVOICECHARGES.BranchCode=INVOICE.BranchCode " _
& " And INVOICE.RemovalNatureCode= " & rs.Fields("RemovalNatureCode") _
& " And INVOICE.TarrifHeadNumber='" & rsRe.Fields("TarrifHeadNumber") & "' " _
& " And month(INVOICE.InvoiceDate)='" & Month(dtpReturnMonth) & "' And year(INVOICE.InvoiceDate)='" & Year(dtpReturnMonth) & "'" _
& " And INVOICE.BranchCode=" & cpBraCode
rsTx.Open SqlStr, CN, adOpenKeyset, adLockReadOnly

If Not IsNull(rsTx.Fields("DutyValue")) Then
varDutyAmount = rsTx.Fields("DutyValue")
End If
rsTx.Close



With lvwDutyPayable.ListItems.Add(, , varSlNo)
.SubItems(1) = rsRe.Fields("TarrifHeadNumber")
.SubItems(2) = rsRe.Fields("GoodsDescription")
.SubItems(3) = "U"
.SubItems(4) = Format$(varInvQty, "0.000")
.SubItems(5) = Format$(varInvQty, "0.000")
.SubItems(6) = Format$(varASValue, "0.00")
.SubItems(7) = ""
.SubItems(8) = rsRe.Fields("ExcemptionNumber")

If rsRe.Fields("ExcemptionNotificationSerialNo") <> 0 Then
.SubItems(9) = rsRe.Fields("ExcemptionNotificationSerialNo")
End If

.SubItems(10) = Format$(varDutyPercent, "0.00")
.SubItems(11) = ""
.SubItems(12) = Format$(varDutyAmount, "0.00")
.SubItems(13) = Format$(varEduAmount, "0.00")
.SubItems(14) = Format$(varSheAmount, "0.00")
End With

I have to pass the all the values like rsRe.Fields("TarrifHeadNumber"),rsRe.Fields("GoodsDescription")
to crystal report.list view will have multiple records.


Please help me to pass the values to crystal report

Thanks and Regards
NR

Viewing all articles
Browse latest Browse all 21192

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>