GET LATEST BLOB OF PD REPORT

This commit is contained in:
velz 2018-12-07 17:41:57 +05:30
parent 4e466f7af2
commit bb46cb91ba
6 changed files with 35 additions and 176 deletions

View File

@ -87,7 +87,7 @@ defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest auto
// define login route name for token verification
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllTemplates/:any)'); // no errors
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'generatePDReport'); // no errors
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getLatestPDReportBlob'); // no errors
/*********************AWS resources Constants*************************************************/
defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic');

View File

@ -166,6 +166,7 @@ $route['calculateAssessedIncome'] = 'PD_Controller/calculateAssessedIncome';
$route['saveAssessedIncomeCalculateMode'] = 'PD_Controller/saveAssessedIncomeCalculateMode';
$route['savePDAdditionalRequiremets'] = 'PD_Controller/savePDAdditionalRequiremets';
$route['generatePDReport'] = 'PD_Controller/generatePDReport';
$route['getLatestPDReportBlob'] = 'PD_Controller/getLatestPDReportBlob';
//PD Form Related
$route['getPDFormDetails'] = 'PD_Controller/getPDFormDetails';

View File

@ -2544,6 +2544,32 @@ class PD_Controller extends REST_Controller {
}
public function getLatestPDReportBlob_post()
{
$records = $this->post('records');
$pdid = $records['pd_id'];
$fields = array('pd_report_latest_version_blob');
$where_condition_array = array('pd_id'=>$pdid);
$result_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDTRIGGER);
if(count($result_array))
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $result_array;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$data['msg'] = 'No Data Available';
$this->response($data,REST_Controller::HTTP_OK);
}
}
public function generatePDReport_post()
{
$records = $this->post('records');
@ -2591,7 +2617,7 @@ class PD_Controller extends REST_Controller {
$output_file = APPPATH."/docs/temp.html";
$ifp = fopen( $output_file, 'wb' );
fwrite( $ifp, $original_template );
//fwrite( $ifp, $original_template );
fwrite( $ifp, $result_array[0]['content'] );
fclose( $ifp );
//print_r($output_file);
@ -2614,7 +2640,7 @@ class PD_Controller extends REST_Controller {
{
$where_condition_array = array("pd_id" => $pdid);
$temp_array = array('is_original_report_created'=>1);
$temp_array = array('is_original_report_created'=>1,'pd_report_latest_version_blob'=>$result_array[0]['content']);
$id = $this->PD_Model->updateRecords($temp_array,PDTRIGGER,$where_condition_array);
$uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,$time = '3600 seconds');
@ -2622,7 +2648,7 @@ class PD_Controller extends REST_Controller {
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = array('pd_report_uri' => $s3result['ObjectURL']);
$data['records'] = array('pd_report_uri' => $uri);
$this->response($data,REST_Controller::HTTP_OK);
}
else
@ -2665,4 +2691,6 @@ class PD_Controller extends REST_Controller {
}
}
}

Binary file not shown.

View File

@ -1,174 +1,4 @@
<p><span style='color:#27ae60'>My </span><span style='color:#27ae60'>html</span><span style='color:#27ae60'> content</span></p><p style='color: #ddd; font-size: 20px;'>Hi {{name_ans}},</p>
<p>This is {{name_ans}}, I am form {{age_ans}}, {{assets_mode}} , your Qualification number ({{qualification_ans}}), has been activated,</p>
<p>can you please verify with your local branch.</p>
<p>Hope will get reply soon!!</p>
<p><strong>Regards,</strong></p>
<p onclick='alert()'>{{name_of_the_owner}},</p>
<p style='font-weight: bold;'>Main Raw Materials are Listed Below</p>
<p>{{main_raw_materials}}</p>
<p style='font-weight: bold;'>Suppliers are Listed Below</p>
<table style='height: 9px; margin-left: auto; margin-right: auto;' border=1 width='401'>
<tbody>
<tr>
<td style='width: 192.5px;'>{{supplier_name}}</td>
<td style='width: 192.5px;'>{{contact_person}}</td>
<td style='width: 192.5px;'>{{mobile_number}}</td>
<td style='width: 192.5px;'>{{payment_mode}}</td>
<td style='width: 192.5px;'>{{frequency_of_purchase}}</td>
</tr>
</tbody>
</table>
<hr>
<svg class='chart' width='420' height='150' aria-labelledby='title desc' role='img'>
<title id='title'>A bar chart showing information</title>
<desc id='desc'>4 apples; 8 bananas; 15 kiwis; 16 oranges; 23 lemons</desc>
<g class='bar'>
<rect width='40' height='19'></rect>
<text x='45' y='9.5' dy='.35em'>4 apples</text>
</g>
<g class='bar'>
<rect width='80' height='19' y='20'></rect>
<text x='85' y='28' dy='.35em'>8 bananas</text>
</g>
<g class='bar'>
<rect width='150' height='19' y='40'></rect>
<text x='150' y='48' dy='.35em'>15 kiwis</text>
</g>
<g class='bar'>
<rect width='160' height='19' y='60'></rect>
<text x='161' y='68' dy='.35em'>16 oranges</text>
</g>
<g class='bar'>
<rect width='230' height='19' y='80'></rect>
<text x='235' y='88' dy='.35em'>23 lemons</text>
</g>
</svg>
<svg viewBox='0 0 500 100' class='chart'>
<polyline
fill='none'
stroke='#0074d9'
stroke-width='2'
points='
00,120
20,60
40,80
60,20
80,80
100,80
120,60
140,100
160,90
180,80
200, 110
220, 10
240, 70
260, 100
280, 100
300, 40
320, 0
340, 100
360, 100
380, 120
400, 60
420, 70
440, 80
'
></polyline>
</svg>
<style>
.bar {
fill: red; /* changes the background */
height: 21px;
transition: fill .3s ease;
cursor: pointer;
font-family: Helvetica, sans-serif;
}
.bar text {
color: black;
}
.bar:hover,
.bar:focus {
fill: black;
}
.bar:hover text,
.bar:focus text {
fill: red;
}
.chart {
background: white;
width: 500px;
height: 100px;
border-left: 1px dotted #555;
border-bottom: 1px dotted #555;
padding: 20px 20px 20px 0;
}
</style>
<script>
var total = 158,
buttons = document.querySelector('.buttons'),
pie = document.querySelector('.pie'),
activeClass = 'active';
var continents = {
asia: 60,
northAmerica : 5,
southAmerica: 9,
oceania: 1,
africa: 15,
europe: 12
};
// work out percentage as a result of total
var numberFixer = function(num){
var result = ((num * total) / 100);
return result;
}
// create a button for each country
for(property in continents){
var newEl = document.createElement('button');
newEl.innerText = property;
newEl.setAttribute('data-name', property);
buttons.appendChild(newEl);
}
// when you click a button setPieChart and setActiveClass
buttons.addEventListener('click', function(e){
if(e.target != e.currentTarget){
var el = e.target,
name = el.getAttribute('data-name');
setPieChart(name);
setActiveClass(el);
}
e.stopPropagation();
});
var setPieChart = function(name){
var number = continents[name],
fixedNumber = numberFixer(number),
result = fixedNumber + ' ' + total;
pie.style.strokeDasharray = result;
}
var setActiveClass = function(el) {
for(var i = 0; i < buttons.children.length; i++) {
buttons.children[i].classList.remove(activeClass);
el.classList.add(activeClass);
}
}
// Set up default settings
setPieChart('asia');
setActiveClass(buttons.children[0]);
</script><p><span style='color:#27ae60'>My </span><span style='color:#27ae60'>html</span><span style='color:#27ae60'> content</span></p><p style='color: #ddd; font-size: 20px;'>Hi Karthi Raj,</p>
<p><span style='color:#27ae60'>My </span><span style='color:#27ae60'>html</span><span style='color:#27ae60'> content</span></p><p style='color: #ddd; font-size: 20px;'>Hi Karthi Raj,</p>
<p>This is Karthi Raj, I am form 50, 2 , your Qualification number (2), has been activated,</p>
<p>can you please verify with your local branch.</p>
<p>Hope will get reply soon!!</p>

View File

@ -21,7 +21,7 @@ class AWS_S3
//echo "listAllBuckets";
$this->S3 = S3Client::factory($this->s3_properties);
// $this->deleteSingleObjFromBucket();
$this->getAllObjectsInaBucket('lender1','pd1');
}