------------------------------------------------------------------------------------------------------------
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
public partial class HTMLReport_rptPaymentVourcher : System.Web.UI.Page
{
clsFnLib objclsFnLib = new clsFnLib();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
try
{
if (Request.QueryString["ID"] != null)
{
Response.ClearHeaders();
Response.AddHeader("content-disposition", "attachment;filename=" + "PVS_Report_" + DateTime.Now.ToString("dd-MMM-yyyy") + ".htm");
//Response.ContentType = "application/vnd.ms-excel";
Response.ContentType = "text/HTML";
StringBuilder data = new StringBuilder();
clsHTMLVoucherReport objclsHTMLVoucherReport = new clsHTMLVoucherReport();
objclsHTMLVoucherReport.VoucherSrNo = Request.QueryString["ID"].ToString();
DataSet dsVD = objclsHTMLVoucherReport.getVoucherDetails();
DataSet dsID = objclsHTMLVoucherReport.getInvoiceDetails();
if (dsVD.Tables[0].Rows.Count == 0)
{
objclsFnLib.WebMessageBox("No Record found.", this);
return;
}
#region write data
#region data above grid
data.Append(@"<html>
<head>
<title>PVS Report_#Date</title>
<script type='text/javascript' language='javascript'>
function printpage()
{
var continue_button = document.getElementById('btnPrint');
continue_button.style.visibility = 'hidden';
window.print()
}
</script>
</head>
<body style='font-family:Arial'>
<table id='tblPage' cellspacing='0'>
<tr id='topSpace' style='height: 50px'>
</tr>
<tr id='trMidlArea'>
<td id='leftSpace' style='width: 10%'>
</td>
<td id='tdMidlArea' style='width: 80%'>
<div id='DEnb' style='text-align:right'><input id='btnPrint' type='button' value='Print this report' onclick='printpage();' /></div>
<div id='DDis' style='text-align:right'><input id='btnPrint1' type='button' Disabled='disabled' value='Print this report' /></div>
<table id='report' border='1' rules='ROWS' frame='BOX' cellspacing='0' width='900px'
cellpadding='0' bordercolor='BLACK'>
<tr id='1stRow'>
<td>
<table width='100%' border='1' rules='cols' frame='vsides' cellspacing='0' bordercolor='BLACK'
style='border-left: 0; border-right: 0' cellpadding='5'>
<tr>
<td>
Date : #Date</td>
<td align='center'>
<b>CROMPTON GREAVES LIMITED
<br />
PAYMENT VOUCHER</b></td>
<td>
Sr. No.: #SrNo</td>
</tr>
</table>
</td>
</tr>
<tr id='2ndRow'>
<td>
<table cellspacing='0' cellpadding='5'>
<tr>
<td>
Name of the Department
</td>
<td>
: #NameOfTheDepartment
</td>
</tr>
<tr>
<td>
Invoice received Date
</td>
<td>
: #InvoicereceivedDate
</td>
</tr>
</table>
</td>
</tr>
<tr id='3rdRow'>
<td>
<table width='100%' cellspacing='0' cellpadding='5'>
<tr>
<td align='left'>
Vendor Name</td>
<td align='left'>
: <span style='text-decoration: underline; font-weight: bold'>#VendorName</span></td>
<td align='right'>
Vendor Code :</td>
<td align='right'>
<span style='text-decoration: underline; font-weight: bold'>#VendorCode</span></td>
</tr>
<tr>
<td align='left'>
G/L Description</td>
<td align='left'>
: #GLDescription</td>
<td align='right'>
G/L Code :</td>
<td align='right'>
#GLCode</td>
</tr>
<tr>
<td align='left'>
Cost Center Description</td>
<td align='left'>
: #CostCenterDescription</td>
<td align='right'>
Cost Center :</td>
<td align='right'>
#CostCenterr</td>
</tr>
</table>
</td>
</tr>
<tr id='4thRow'>
<td>
<table cellspacing='0' cellpadding='5'>
<tr>
<td>
Debit to Division/Region/Dept.: #DebitToDiv</td>
</tr>
</table>
</td>
</tr>
<tr id='5thRow'>
<td>
<table border='1' rules='cols' frame='vsides' width='100%' cellspacing='0' bordercolor='BLACK'
cellpadding='5'>
<tr>
<td >
From : #From
</td>
<td>
To : #To
</td>
</tr>
<tr>
<td style='width: 50%'>
RefFrom : #RefFrom
</td>
<td>
RefTo : #RefTo
</td>
</tr>
</table>
</td>
</tr>
<tr id='6thRow'>
<td>
<table cellspacing='0' cellpadding='5'>
<tr>
<td>
Kindly issue cheque in favour of</td>
<td>
: <span style='text-decoration: underline; font-weight: bold'>#ChequeInFaourOf</span></td>
</tr>
<tr>
<td>
Amount In Figures</td>
<td>
: <span style='text-decoration: underline; font-weight: bold'>#AmountInFigures</span></td>
</tr>
<tr>
<td>
Amount In Words
</td>
<td>
: <span style='text-decoration: underline; font-weight: bold'>#AmountInWords</span>
</td>
</tr>
</table >
<table border='1' rules='cols' width='100%' cellspacing='0' bordercolor='BLACK' cellpadding='5'>
<tr>
<td>
Type of services : <span >#vServiceName</span>
</td>
<td style='display:#displayService;'>
Service received from person : <span >#vProviderName</span>
</td>
</tr>
<tr style='display:#displayService;'>
<td>
Applicability of service tax liability :<span >#chIsApplicable</span>
</td>
<td>
% of liability : <span >#nLiability</span>
</td>
</tr>
</table>
</td>
</tr>
<tr id='7thRow'>
<td>
<table border='1' bordercolor='BLACK' cellspacing='0' width='100%' style='border-left: 0;
border-right: 0; border-top: 0; border-bottom: 0' cellpadding='5'>
<tr>
<td colspan='7'>
Invoice Details
</td>
<td colspan='2'>
Details Of Advance Paid
</td>
</tr>
<tr>
<td>
Sr. No.
</td>
<td>
Invoice No.
</td>
<td>
Invoice Date
</td>
<td>
PO No.
</td>
<td>
PO. Date
</td>
<td>
SAP GRIR No.
</td>
<td>
Invoice Amount
</td>
<td>
Date
</td>
<td>
Amount
</td>
</tr>");
data.Replace("#Date", DateTime.Now.ToString("dd-MMM-yyyy"));
data.Replace("#SrNo", Request.QueryString["ID"].ToString());
data.Replace("#NameOfTheDepartment", dsVD.Tables[0].Rows[0]["vDepartmentName"].ToString());
data.Replace("#InvoicereceivedDate", dsVD.Tables[0].Rows[0]["dtInvoiceReceivedDate"].ToString());
data.Replace("#VendorName", dsVD.Tables[0].Rows[0]["vVendorName"].ToString());
data.Replace("#VendorCode", dsVD.Tables[0].Rows[0]["vVendorCode"].ToString());
data.Replace("#GLDescription", dsVD.Tables[0].Rows[0]["vGLDescription"].ToString());
data.Replace("#GLCode", dsVD.Tables[0].Rows[0]["vGLID"].ToString());
data.Replace("#CostCenterr", dsVD.Tables[0].Rows[0]["vCostCentre"].ToString());
data.Replace("#CostCenterDescription", dsVD.Tables[0].Rows[0]["vCostCentreName"].ToString());
data.Replace("#DebitToDiv", dsVD.Tables[0].Rows[0]["vDebitToDivision"].ToString());
data.Replace("#From", dsVD.Tables[0].Rows[0]["vFrom"].ToString());
data.Replace("#To", dsVD.Tables[0].Rows[0]["vTo"].ToString());
data.Replace("#RefFrom", dsVD.Tables[0].Rows[0]["vFromRef"].ToString());
data.Replace("#RefTo", dsVD.Tables[0].Rows[0]["vToRef"].ToString());
data.Replace("#ChequeInFaourOf", dsVD.Tables[0].Rows[0]["vIssueChqInFavour"].ToString());
data.Replace("#AmountInFigures", dsVD.Tables[0].Rows[0]["nAmount"].ToString());
data.Replace("#AmountInWords", dsVD.Tables[0].Rows[0]["vAmountInWords"].ToString());
if (dsVD.Tables[0].Rows[0]["vServiceName"].ToString()!="")
{
data.Replace("#vServiceName", dsVD.Tables[0].Rows[0]["vServiceName"].ToString());
data.Replace("#displayService", " ");
data.Replace("#vProviderName", dsVD.Tables[0].Rows[0]["vProviderName"].ToString());
data.Replace("#chIsApplicable", dsVD.Tables[0].Rows[0]["chIsApplicable"].ToString());
}
else
{
data.Replace("#vServiceName"," Not Applicable.");
data.Replace("#displayService", "none");
}
if (dsVD.Tables[0].Rows[0]["nLiability"].ToString() == "" || dsVD.Tables[0].Rows[0]["nLiability"].ToString() == "0")
{
data.Replace("#nLiability", "NIL");
}
else
{
data.Replace("#nLiability", dsVD.Tables[0].Rows[0]["nLiability"].ToString());
}
#endregion
#region Grid
for (int i = 0; i < dsID.Tables[0].Rows.Count; i++)
{
data.Append(@"<tr>
<td>
#tblSrNo
</td>
<td>
#tblInvoiceNo
</td>
<td>
#tblInvoiceDate
</td>
<td>
#tblPONo
</td>
<td>
#tblPODate
</td>
<td>
#tblSAPGRIRNo
</td>
<td>
#tblInvoiceAmount
</td>
<td>
#tblDate
</td>
<td>
#tblAmount
</td>
</tr>");
data.Replace("#tblSrNo", (i + 1).ToString());
data.Replace("#tblInvoiceNo", dsID.Tables[0].Rows[i]["vInvoiceNo"].ToString());
data.Replace("#tblInvoiceDate", dsID.Tables[0].Rows[i]["dtInvoiceDate"].ToString());
data.Replace("#tblPONo", dsID.Tables[0].Rows[i]["vPONo"].ToString());
data.Replace("#tblPODate", dsID.Tables[0].Rows[i]["dtPODate"].ToString());
data.Replace("#tblSAPGRIRNo", dsID.Tables[0].Rows[i]["vSAPGRIRNo"].ToString());
data.Replace("#tblInvoiceAmount", dsID.Tables[0].Rows[i]["nInvoiceAmount"].ToString());
data.Replace("#tblDate", dsID.Tables[0].Rows[i]["dtAdvanceDate"].ToString());
data.Replace("#tblAmount", dsID.Tables[0].Rows[i]["nAdvanceAmount"].ToString());
}
#endregion
#region after grid
data.Append(@"
</table>
</td>
</tr>
<tr id='8th Row'>
<td>
<table width='100%' cellspacing='0' cellpadding='5'>
<tr>
<td style='width:18%'>
Towards payment for</td>
<td style='width:60%'>
: 1. #TowardsPaymentFor1</td>
<td>
</td>
<td>
</td>
</tr>
<tr id='trTowardsPaymentFor2'>
<td>
</td>
<td>
: 2. #TowardsPaymentFor2</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
Due Date</td>
<td>
: #DueDate</td>
<td>
TDS-Rate</td>
<td>
: #TDS-Rate</td>
</tr>
</table>
</td>
</tr>
<tr id='9thRow'>
<td>
<table border='1' cellspacing='0' width='100%' bordercolor='BLACK' style='border-left: 0;
border-right: 0; border-top: 0; border-bottom: 0' cellpadding='5'>
<tr>
<td style='width: 34%'>
Raised By :</td>
<td style='width: 33%'>
Checked By :</td>
<td style='width: 33%'>
Authorised By :</td>
</tr>
<tr>
<td valign='top' style='width: 34%'>
<table cellspacing='0'>
<tr>
<td style='width: 60%'>
Name</td>
<td style='width: 40%'>
: #NameRaisedBy</td>
</tr>
<tr>
<td style='width: 60%'>
Date</td>
<td style='width: 40%'>
: #DateRaisedBy</td>
</tr>
<tr>
<td style='width: 60%'>
Remark</td>
<td style='width: 40%'>
: #RemarkRaisedBy</td>
</tr>
<tr>
<td style='width: 60%'>
Signature</td>
<td style='width: 40%'>
: #Signature</td>
</tr>
</table>
</td>
<td valign='top' style='width: 33%'>
<table cellspacing='0'>
<tr>
<td colspan='2'>
Electronically approved by : #ElectronicallyApprovedByCheckedBy</td>
</tr>
<tr>
<td style='width: 60%'>
Date</td>
<td style='width: 40%'>
: #DateCheckedBy</td>
</tr>
<tr>
<td style='width: 60%'>
Remark</td>
<td style='width: 40%'>
: #RemarkCheckedBy</td>
</tr>
</table>
</td>
<td valign='top' style='width: 33%'>
<table cellspacing='0'>
<tr>
<td colspan='2'>
Electronically approved by : #ElectronicallyApprovedByAuthorisedBy</td>
</tr>
<tr>
<td style='width: 60%'>
Date</td>
<td style='width: 40%'>
: #DateAuthorisedBy</td>
</tr>
<tr>
<td style='width: 60%'>
Remark</td>
<td style='width: 40%'>
: #RemarkAuthorisedBy</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr id='ElectronicApproveRow'>
<td>
<table cellspacing='0' cellpadding='5'>
<tr>
<td>
Electronically approved By
</td>
<td>
: #ElectronicallyapprovedBySepRowName</td>
</tr>
<tr>
<td>
Date
</td>
<td>
: #ElectronicallyapprovedBySepRowDate
</td>
</tr>
<tr>
<td>
Remark
</td>
<td>
: #ElectronicallyapprovedBySepRowRemark
</td>
</tr>
</table>
</td>
</tr>
<tr id='ComputerRelatedApproveRow'>
<td>
<table cellspacing='0' cellpadding='5'>
<tr>
<td>
Computer Related approved By
</td>
<td>
: #ComputerRelatedapprovedBySepRowName</td>
</tr>
<tr>
<td>
Date
</td>
<td>
: #ComputerRelatedapprovedBySepRowDate
</td>
</tr>
<tr>
<td>
Remark
</td>
<td>
: #ComputerRelatedapprovedBySepRowRemark
</td>
</tr>
</table>
</td>
</tr>
<tr id='10thRow'>
<td>
<table cellspacing='0' cellpadding='5'>
<tr>
<td>
E-Payment details of the vendor has been provided: Yes/No</td>
<td>
: #EPaymentDetailsYesNo</td>
</tr>
<tr>
<td colspan='2'>
If no, then please provide separately as per the format.</td>
</tr>
</table>
</td>
</tr>
<tr id='11thRow'>
<td>
<table width='100%' cellspacing='0' cellpadding='5'>
<tr>
<td colspan='4'>
<span style='font-weight: bold'>For Accounts Department use only :</span></td>
</tr>
<tr>
<td style='width: 25%'>
</td>
<td style='width: 25%'>
</td>
<td style='width: 25%'>
Approved by(1)</td>
<td style='width: 25%'>
: #Approvedby(1)Name</td>
</tr>
<tr>
<td>
Received Date</td>
<td>
: #ReceivedDate</td>
<td>
Date</td>
<td>
: #AccountsReceivedDate</td>
</tr>
<tr>
<td>
Checked By</td>
<td>
: #AccountsCheckedBy</td>
<td>
Remark</td>
<td>
: #Approvedby(1)Remark</td>
</tr>
<tr>
<td>
Date</td>
<td>
: #AccountsDateCheckedBy</td>
<td>
Approved By(2)</td>
<td>
: #ApprovedBy(2)Name</td>
</tr>
<tr>
<td>
Remark</td>
<td>
: #CheckedByRemark</td>
<td>
Date</td>
<td>
: #Approvedby(2)Date</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
Remark</td>
<td>
: #Approvedby(2)Remark</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td id='tdRightSpace' style='width: 10%'>
</td>
</tr>
<tr id='botomSpace' style='height: 20px'>
</tr>
</table>
</body>
</html>
");
data.Replace("#TowardsPaymentFor1", dsVD.Tables[0].Rows[0]["vTowardsPaymentFor1"].ToString());
if (dsVD.Tables[0].Rows[0]["vTowardsPaymentFor2"].ToString() == "")
data.Replace("id='trTowardsPaymentFor2'", "style='display:none'");
data.Replace("#TowardsPaymentFor2", dsVD.Tables[0].Rows[0]["vTowardsPaymentFor2"].ToString());
data.Replace("#DueDate", dsVD.Tables[0].Rows[0]["dtDueDate"].ToString());
data.Replace("#TDS-Rate", dsVD.Tables[0].Rows[0]["nTDSRate"].ToString());
data.Replace("#NameRaisedBy", dsVD.Tables[0].Rows[0]["UM"].ToString());
data.Replace("#DateRaisedBy", dsVD.Tables[0].Rows[0]["dtVoucherRaisedDate"].ToString());
data.Replace("#RemarkRaisedBy", dsVD.Tables[0].Rows[0]["vRaiseByRemark"].ToString());
data.Replace("#Signature", "");
data.Replace("#ElectronicallyApprovedByCheckedBy", dsVD.Tables[0].Rows[0]["UM1"].ToString());
data.Replace("#DateCheckedBy", dsVD.Tables[0].Rows[0]["dtVoucherCheckedDate"].ToString());
data.Replace("#RemarkCheckedBy", dsVD.Tables[0].Rows[0]["vCheckByRemark"].ToString());
data.Replace("#ElectronicallyApprovedByAuthorisedBy", dsVD.Tables[0].Rows[0]["UM2"].ToString());
data.Replace("#DateAuthorisedBy", dsVD.Tables[0].Rows[0]["dtVoucherAuthorisedDate"].ToString());
data.Replace("#RemarkAuthorisedBy", dsVD.Tables[0].Rows[0]["vAuthorisedRemark"].ToString());
if (dsVD.Tables[0].Rows[0]["btEPaymentDetails"].ToString().ToUpper() == "TRUE")
data.Replace("#EPaymentDetailsYesNo", "Yes");
else
data.Replace("#EPaymentDetailsYesNo", "No");
data.Replace("#Approvedby(1)Name", dsVD.Tables[0].Rows[0]["UM4"].ToString());
data.Replace("#ReceivedDate", dsVD.Tables[0].Rows[0]["dtVoucherReceivedDate_Account"].ToString());
data.Replace("#AccountsReceivedDate", dsVD.Tables[0].Rows[0]["dtVoucherReceivedDate_Account"].ToString());
data.Replace("#AccountsCheckedBy", dsVD.Tables[0].Rows[0]["UM3"].ToString());
data.Replace("#Approvedby(1)Remark", dsVD.Tables[0].Rows[0]["vApproval1"].ToString());
data.Replace("#AccountsDateCheckedBy", dsVD.Tables[0].Rows[0]["dtVoucherCheckedByDate_Account"].ToString());
data.Replace("#ApprovedBy(2)Name", dsVD.Tables[0].Rows[0]["UM5"].ToString());
data.Replace("#CheckedByRemark", dsVD.Tables[0].Rows[0]["vCheckBy"].ToString());
data.Replace("#Approvedby(2)Date", dsVD.Tables[0].Rows[0]["dtVoucherApprovedByDate_Account2"].ToString());
data.Replace("#Approvedby(2)Remark", dsVD.Tables[0].Rows[0]["vApproval2"].ToString());
#region Electronic & Computer Related approval
if (Convert.ToDecimal(dsVD.Tables[0].Rows[0]["nAmount"].ToString()) > 500000)
{
data.Replace("#ElectronicallyapprovedBySepRowName", dsVD.Tables[0].Rows[0]["UM6"].ToString());
data.Replace("#ElectronicallyapprovedBySepRowDate", dsVD.Tables[0].Rows[0]["vCpDate"].ToString());
data.Replace("#ElectronicallyapprovedBySepRowRemark", dsVD.Tables[0].Rows[0]["vCpRemark"].ToString());
}
else
{
data.Replace("id='ElectronicApproveRow'", "style='display:none'");
}
if (Convert.ToBoolean(dsVD.Tables[0].Rows[0]["btCompRelated"].ToString()) == true)
{
data.Replace("#ComputerRelatedapprovedBySepRowName", dsVD.Tables[0].Rows[0]["CompRelated"].ToString());
data.Replace("#ComputerRelatedapprovedBySepRowDate", dsVD.Tables[0].Rows[0]["dtCompRelatedApproveDate"].ToString());
data.Replace("#ComputerRelatedapprovedBySepRowRemark", dsVD.Tables[0].Rows[0]["vCompRelatedRemark"].ToString());
}
else
{
data.Replace("id='ComputerRelatedApproveRow'", "style='display:none'");
}
if (dsVD.Tables[0].Rows[0]["UM2"].ToString()=="")
data.Replace("id='DEnb'", "style='display:none'");
else
data.Replace("id='DDis'", "style='display:none'");
#endregion
//after grid
#endregion
#endregion
Response.Write(data);
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}
No comments:
Post a Comment