in c#
{
sql = "select (SELECT EMPTITLE+' '+EMPNAME FROM MAEMP WHERE EMPNO=PRNPAYSHEETSHORT.EMPNO) 'EMPNO',BASIC,DA,BASIC+DA 'EARN SALARY',PF,PAYMONTH,PAYEAR"
+ ",(select CNAME from company where ccode=COMPANY)'COMPANY',(select CADDRESS from company where ccode=PRNPAYSHEETSHORT.CADDRESS)'CADDRESS' "
+"from PRNPAYSHEETSHORT JOIN MASECTION ON MASECTION.MAINCTCODE=PRNPAYSHEETSHORT.DEPT where PAYMONTH='" + cmbMonth.SelectedValue.ToString()
+ "' AND PAYEAR='" + year + "' order by PRIORITY ASC,convert(numeric,substring(EMPNO,2,10)) asc,DEPT asc,'EMPNO' ASC";
DataTable d1 = c.showDataTable(sql);
frmReport frm = new frmReport();
cryPrintPF cry = new cryPrintPF();
cry.SetDataSource(d1);
frm.crystalReportViewer1.ReportSource = cry;
frm.Show();
}
in vb.net
Dim cry
If (name_type <> "") Then
If (name_type = "Owner") Then
sql += vbNewLine & " order by Owner_Name1,Owner_Name2,Owner_Name3 "
cry = New rpt_firm_owner
End If
If (name_type = "Prod.Mgr.") Then
sql += vbNewLine & " order by P_Mgr_Auth1,P_Mgr_Auth2 "
cry = New rpt_firm_prod_man
End If
If (name_type = "Acc.Mgr.") Then
sql += vbNewLine & " order by Acc_Mgr1, Acc_Mgr2 "
cry = New rpt_firm_acc_mgr
End If
If (name_type = "Coordin.") Then
sql += vbNewLine & " order by Cordinator1, Cordinator2 "
cry = New rpt_firm_coordinator
End If
Else
sql += " order by firm_name"
End If
Dim dt = DataTable(sql)
If (dt.Rows.Count < 1) Then
MsgBox("Data Not available.")
Return
End If
Dim frm As New frm_report
cry.SetDataSource(dt)
frm.CrystalReportViewer1.ReportSource = cry
frm.Show()
No comments:
Post a Comment