Monica Bundel

Monica Bundel

  • NA
  • 101
  • 21.6k

printing issue

Feb 18 2016 12:43 AM
hi,
 
i have my print design in following way in asp
 
<table id="jqGrid"></table>
<div id="jqGridPager"></div>
<div id="PurchaseOrderSlip" class="floatingBox hidden three" style="width: 560px; height: 769px;">
<div class="container-fluid">
<br />
<br />
<br />
<br />
<br />
<br />
<table style="font-size: 14px">
<tr>
<td style="width: 360px;">Excise Regn. No &nbsp;:&nbsp;AAACY2820KXM001<br />
Range&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;Kancheepuram<br />
Division : &nbsp;&nbsp;&nbsp;Tambaram, Chennai.
<br />
</td>
<td style="width: 220px;">Commissionerate :&nbsp; Tambaram
<br />
Service Tax Regn.No.&nbsp;&nbsp; :&nbsp;AAACY2820KST001
<br />
PAN <span style="padding-left: 39px"></span>: AAACY2820K<br />
</td>
<td style="width: 220px;">TIN<span style="padding-left: 40px"></span>&nbsp; : 33090762171<br />
CST No<span style="padding-left: 21px"></span>&nbsp; : 877145/21.05.2007<br />
Area Code <span style="padding-left: 10px"></span>: 0 3 9
</td>
</tr>
</table>
<hr />
<center> <h4> Purchase Order</h4></center>
<table style="font-size: 14px">
<tr>
<td style="width: 350px"><b>PO NO </b>
<b>
<label id="poNo"></label>
</b>
</td>
<td style="width: 200px"></td>
<td style="width: 350px; margin-left: 125px;"><b>PO Date </b>
<b>
<label id="poDate"></label>
</b>
</td>
</tr>
<tr>
<td style="width: 350px">Address
<b>
<label id="compname"></label>
</b>
<br />
<label id="compadd1"></label>
<br />
<label id="compadd2"></label>
<br />
<label id="dist"></label>
<br />
<label id="state"></label>
<br />
<label id="pincode"></label>
</td>
<td style="width: 200px;"></td>
<td style="width: 350px">
<b>Vendor Code:
<label id="codeno"></label>
</b>
<br />
ECC No :<label id="eccNo"></label>
<br />
Range No:
<label id="cRangeNo"></label>
<br />
Division :
<label id="cDivision"></label>
<br />
CST NO :
<label id="cstNo"></label>
<br />
TIN NO:
<label id="tinNo"></label>
<br />
Sales Tax:
<label id="salesTax"></label>
</td>
</tr>
</table>
</div>
<br />
<div style="font-size: 14px">
We are pleased to place the Order for the following on you, Subject to our Terms and Conditions printed Overleaf.
</div>
<br />
 
this is my print function which will call below function :
 
function PurchaseDetails()
{
// alert('hi');
var myGrid = $('#jqGrid'),
selRowId = myGrid.jqGrid('getGridParam', 'selrow'),
_id = myGrid.jqGrid('getCell', selRowId, 'POID');
$.ajax({
url: "../api/InventoryApi/PurchaseOrderPrintData",
type: "Post",
data: JSON.stringify([_id]), //{ Name: name, Address: address, DOB: dob },
contentType: 'application/json; charset=utf-8',
success: function (data) {
// var details = data.split('+');
document.getElementById("PurchaseOrder_Slip").innerHTML = data;
setTimeout("Terms_Table("+_id+")", 500)
//PrintSlip()
},
error: function () { }
});
}
 
 
this is my print function in controller:
 
 
public string PurchaseOrderPrintData(List<String> _data)
{
string _pofId = _data[0];
string var_data = "";
string _sTotWords = "";
int var_Row_Count; decimal _Pomaintotal = 0; string ret_data = ""; string var_d = "";
int Count = 1;
try
{
using (SqlConnection obj_Connn = new SqlConnection(var_Con_Str))
{
if (obj_Connn.State == System.Data.ConnectionState.Closed)
obj_Connn.Open();
SqlCommand obj_Com = new SqlCommand();
SqlDataReader obj_Reader;
obj_Com.Connection = obj_Connn;
obj_Com.CommandText = "SELECT TBL_PURCHASE_ORDER_DETAIL.*, TBL_ITEM_MASTER.F_ITEM_NO, TBL_ITEM_MASTER.F_ITEM_NAME,TBL_ITEM_MASTER.F_DESCRIPTION_1,TBL_ITEM_MASTER.F_DESCRIPTION_2, TBL_ITEM_MASTER.F_UOM, TBL_PURCHASE_ORDER_DETAIL.F_BASIC AS BASIC FROM TBL_PURCHASE_ORDER INNER JOIN TBL_PURCHASE_ORDER_DETAIL ON TBL_PURCHASE_ORDER.F_ID = TBL_PURCHASE_ORDER_DETAIL.F_ID_PO INNER JOIN TBL_ITEM_MASTER ON TBL_PURCHASE_ORDER_DETAIL.F_ID_ITEM = TBL_ITEM_MASTER.F_ID WHERE TBL_PURCHASE_ORDER.F_ID=" + _pofId + "";
obj_Reader = obj_Com.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
DataTable obj_Data_tbl = new DataTable();
obj_Data_tbl.Load(obj_Reader);
var_Row_Count = obj_Data_tbl.Rows.Count;
foreach (DataRow obj_Data_Row in obj_Data_tbl.Rows)
{
decimal _poqty = Convert.ToDecimal(obj_Data_Row["F_QTY"].ToString());
decimal _pobasic = Convert.ToDecimal(obj_Data_Row["F_BASIC"].ToString());
decimal _poTotal = _poqty * _pobasic;
string _formtotal = String.Format("{0:#,###,###.##}", _poTotal);// String.Format("{0:n}", _poTotal);
_Pomaintotal = _Pomaintotal + _poTotal;
var_data += "<tr role=\"row\" ><td style=\"padding-bottom: 5px;padding-top: 5px\"><center>" + Count + "</center</td><td style=\"padding-bottom: 5px;padding-top: 5px\">" + obj_Data_Row["F_DESCRIPTION_1"] + "," + obj_Data_Row["F_DESCRIPTION_2"] + "</td><td style=\"padding-bottom: 5px;padding-top: 5px\"><center>" + obj_Data_Row["F_UOM"] + "</center></td><td style=\"padding-bottom: 5px;padding-top: 5px\"><center> " + Convert.ToDecimal(obj_Data_Row["F_QTY"]).ToString("0,0.00") + "</center></td><td style=\"padding-bottom: 5px;padding-top: 5px\"><center>" + Convert.ToDecimal(obj_Data_Row["F_BASIC"]).ToString("0,0.00") + "</center></td><td style=\"padding-bottom: 5px;padding-top: 5px\"><center>" + _formtotal + "</center></td></tr>";
Count++;
}
// _Pomaintotal = 1000000000;
if (_Pomaintotal > 1000000000)
{
string _formmaintotal = String.Format("{0:#,###,###.##}", _Pomaintotal);
var_d += "<tr style=\"border-top:1px solid black ; border-bottom: 1px solid black\" role=\"row\"><td colspan=5 style=\"padding-bottom: 2px;padding-top: 2px\"> </td> <td style=\"padding-bottom: 5px;padding-top: 5px\"><center>" + _formmaintotal + "</center></td></tr>";
}
else
{
_sTotWords = NumbersToWords(_Pomaintotal); string _formmaintotal = String.Format("{0:#,###,###.##}", _Pomaintotal);
var_d += "<tr style=\"border-top:1px solid black ; border-bottom: 1px solid black\" role=\"row\"><td colspan=5 style=\"padding-bottom: 2px;padding-top: 2px\">" + _sTotWords + " Only </td> <td style=\"padding-bottom: 5px;padding-top: 5px\"><center>" + _formmaintotal + "</center></td></tr>";
}
ret_data = var_data + var_d;
}
}
catch (Exception)
{ }
return ret_data;
}
 
 
my problem is i want to print in 1 page only 8 columns and repeat the header in each page how can i do that... can anyone help me out... 

Answers (2)