Jump to content

winuser2003

Members
  • Posts

    110
  • Joined

  • Last visited

About winuser2003

  • Birthday 07/09/1978

Contact Methods

  • AIM
    winuser2003
  • MSN
    north_pj@hotmail.com
  • Website URL
    http://Paulspc.isgreat.org
  • Yahoo
    winuser2003

Profile Information

  • Gender
    Male
  • Location
    Kentucky

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

winuser2003's Achievements

Regular Member

Regular Member (3/5)

1

Reputation

  1. No definitely not.... I will try adding a couple entries to the array and see what happens
  2. So this is where I need to make the adjustment?
  3. Line 141 : $this->Cell($this->widths[$k], 5, $v, 0, 0, $this->aligns[$k]);
  4. is this because because of the width? this is the error I got Notice: Undefined offset: 6 in /var/www/html/pmapp/reporttest/pm_bill_pdf.php on line 141 Fatal error: Uncaught Exception: FPDF error: Some data has already been output, can't send PDF file (output started at /var/www/html/pmapp/reporttest/pm_bill_pdf.php:141) in /var/www/html/pmapp/reporttest/fpdf/fpdf.php:271 Stack trace: #0 /var/www/html/pmapp/reporttest/fpdf/fpdf.php(1049): FPDF->Error() #1 /var/www/html/pmapp/reporttest/fpdf/fpdf.php(999): FPDF->_checkoutput() #2 /var/www/html/pmapp/reporttest/pm_bill_pdf.php(163): FPDF->Output() #3 {main} thrown in /var/www/html/pmapp/reporttest/fpdf/fpdf.php on line 271
  5. Just showing my changes, its just showing 1 error now on line 141 <?php ini_set('display_errors', 1); session_start(); if (!isset($_SESSION['user_id'])) { header("Location: pm_login.php"); exit; } include '../reporttest/fpdf/fpdf.php'; include 'db_inc.php'; $conn = pdoConnect(); class PMpdf extends fpdf { protected $today; protected $headbase; protected $db; protected $month; protected $monthname; protected $brand; protected $state; protected $store; protected $widths; protected $aligns; //constructor public function __construct($db, $month, $brand, $state, $store) { parent::__construct('P', 'mm', 'Letter'); $this->today = date('jS M Y'); $this->monthname = (new DateTime("{$month}-01"))->format('F Y'); $this->db = $db; $this->month = $month; $this->brand = $brand; $this->statecode = $state; $this->store = $store; $this->SetMargins(20, 10, 15); $this->widths = [25,65,30,20,20,20]; $this->aligns = ['L','L','L','R','R','R']; } //Page header public function Header() { $this->Image('badger_logo.PNG', 18, 10, 40); $this->SetX(90); $this->SetFont('Helvetica', '', 18); $this->Cell(90, 8, "PM Total Hours", 0, 2, 'C'); $this->SetFontSize(14); $this->Cell(90, 8, $this->monthname, 0, 1, 'C'); $this->SetFont('','B',8); $this->Ln(5); $heads = ['Brand Name', 'Store', 'Robot', 'Date', 'Duration', 'Store Hrs']; foreach ($heads as $k => $h) { $this->Cell($this->widths[$k], 5, $h, 'TB', 0, $this->aligns[$k]); } $this->Ln(5); $this->headbase = $this->GetY(); $this->SetFont('',''); } //Page footer public function Footer() { $this->setY(-18); $this->setX(20); $this->SetFont('Helvetica', '', 8); $this->Cell(90,5,'( '.$this->today.' )', 'T', 0); $this->Cell(0,5,$this->PageNo().' of {nb}', 'T', 0, 'R'); } public function createSummaryReport() { $where = ['v.checkin_time LIKE ?', 'a.user_id = ?']; $params = [$this->month . '%', $_SESSION['user_id'] ]; $whereclause = ''; if ($this->brand) { $where[] = "s.client_id = ?"; $params[] = $this->brand; } if ($this->statecode) { $where[] = "s.state = ?"; $params[] = $this->statecode; } if ($this->store) { $where[] = "v.store_num = ?"; $params[] = $this->store; } $tdata = ''; $whereclause = 'WHERE ' . join(' AND ', $where); $res = $this->db->prepare("SELECT c.brand , CONCAT(LPAD(s.store_num,4,'0'), ' ', s.store_address) as store , v.robot_num , v.checkin_time , v.checkout_time , date_format(v.checkin_time, '%m/%d/%Y') as date , round(timestampdiff(SECOND, checkin_time, checkout_time)/3600,2) as total FROM pm_visit v JOIN store s USING (store_num) JOIN client c USING (client_id) JOIN user_client_access a USING (client_id) $whereclause ORDER BY brand, store, robot_num "); $res->execute($params); $prevs=''; $prevb = ''; $stotal = $btotal = 0; foreach ($res as $r) { $brandname = $r['brand']==$prevb ? '' : $r['brand']; $storename = $r['store']==$prevs ? '' : $r['store']; $saveb = $r['brand']; $saves = $r['store']; array_shift($r); array_shift($r); if ($saveb <> $prevb) { if ($prevb) { $this->Cell($this->widths[5], 5, number_format($stotal, 2), 0, 1, $this->aligns[5]); $this->Cell(180 - $this->widths[5], 5, $prevb, 0, 0, 'R', 1); $this->Cell($this->widths[5], 5, number_format($btotal, 2), 'TB', 1, $this->aligns[5], 0); $stotal = $btotal = 0; $this->AddPage(); } } elseif ($saves <> $prevs) { $this->Cell($this->widths[5], 5, number_format($stotal, 2), 0, 1, $this->aligns[5]); $stotal = 0; } else $this->Ln(); $cells = [$brandname, $storename, $r['checkin_time'], $r['checkout_time'], $r['robot_num'], $r['date'], $r['total']]; foreach ($cells as $k => $v) { $this->Cell($this->widths[$k], 5, $v, 0, 0, 0, 0, $this->aligns[$k]); } $stotal += $r['total']; $btotal += $r['total']; $prevb = $saveb; $prevs = $saves; } if ($btotal) { $this->Cell($this->widths[5], 5, number_format($stotal, 2), 0, 1, 'R'); $this->Cell(180 - $this->widths[5], 5, $prevb, 0, 0, 'R', 1); $this->Cell($this->widths[5], 5, number_format($btotal, 2), 'TB', 1, 'R', 0); } } } $pdf = new PMpdf($conn, $_GET['ym'], $_GET['brand'], $_GET['state'], $_GET['store']); $pdf->AliasNbPages(); $pdf->SetFillColor(200); $pdf->SetDrawColor(120); $pdf->addPage(); $pdf->createSummaryReport(); $pdf->output(); ?>
  6. this is what I have in the DB
  7. Yes the 2 cols are in the database already, I am just looking for the right spot to add the cell outputs to the code is all. Yes, its a simple problem I believe. I am a coder yes, but not as experienced.
  8. Hi, An old friend of mine coded this, so I am just trying to work with his script he helped me out with is all. I am just weeding through how he has everything setup. I will try your suggestion and thank you for your help...
  9. Hi, I have a print to pdf script written that allows a specific chart I have to be printed to PDF. I just need to add 2 more columns to this table. I am not used to the print to pdf function so this is why I am asking. Let me introduce what the report currently shows as far as its headers. What I would like to add to these headers is a check in and check out column The Print to PDF code is as follows: <?php ini_set('display_errors', 1); session_start(); if (!isset($_SESSION['user_id'])) { header("Location: pm_login.php"); exit; } include '../reporttest/fpdf/fpdf.php'; include 'db_inc.php'; $conn = pdoConnect(); class PMpdf extends fpdf { protected $today; protected $headbase; protected $db; protected $month; protected $monthname; protected $brand; protected $state; protected $store; protected $widths; protected $aligns; //constructor public function __construct($db, $month, $brand, $state, $store) { parent::__construct('P', 'mm', 'Letter'); $this->today = date('jS M Y'); $this->monthname = (new DateTime("{$month}-01"))->format('F Y'); $this->db = $db; $this->month = $month; $this->brand = $brand; $this->statecode = $state; $this->store = $store; $this->SetMargins(20, 10, 15); $this->widths = [25,65,30,20,20,20]; $this->aligns = ['L','L','L','R','R','R']; } //Page header public function Header() { $this->Image('badger_logo.PNG', 18, 10, 40); $this->SetX(90); $this->SetFont('Helvetica', '', 18); $this->Cell(90, 8, "PM Total Hours", 0, 2, 'C'); $this->SetFontSize(14); $this->Cell(90, 8, $this->monthname, 0, 1, 'C'); $this->SetFont('','B',8); $this->Ln(5); $heads = ['Brand Name', 'Store', 'Robot', 'Date', 'Duration', 'Store Hrs']; foreach ($heads as $k => $h) { $this->Cell($this->widths[$k], 5, $h, 'TB', 0, $this->aligns[$k]); } $this->Ln(5); $this->headbase = $this->GetY(); $this->SetFont('',''); } //Page footer public function Footer() { $this->setY(-18); $this->setX(20); $this->SetFont('Helvetica', '', 8); $this->Cell(90,5,'( '.$this->today.' )', 'T', 0); $this->Cell(0,5,$this->PageNo().' of {nb}', 'T', 0, 'R'); } public function createSummaryReport() { $where = ['v.checkin_time LIKE ?', 'a.user_id = ?']; $params = [$this->month . '%', $_SESSION['user_id'] ]; $whereclause = ''; if ($this->brand) { $where[] = "s.client_id = ?"; $params[] = $this->brand; } if ($this->statecode) { $where[] = "s.state = ?"; $params[] = $this->statecode; } if ($this->store) { $where[] = "v.store_num = ?"; $params[] = $this->store; } $tdata = ''; $whereclause = 'WHERE ' . join(' AND ', $where); $res = $this->db->prepare("SELECT c.brand , CONCAT(LPAD(s.store_num,4,'0'), ' ', s.store_address) as store , v.robot_num , date_format(v.checkin_time, '%m/%d/%Y') as date , round(timestampdiff(SECOND, checkin_time, checkout_time)/3600,2) as total FROM pm_visit v JOIN store s USING (store_num) JOIN client c USING (client_id) JOIN user_client_access a USING (client_id) $whereclause ORDER BY brand, store, robot_num "); $res->execute($params); $prevs=''; $prevb = ''; $stotal = $btotal = 0; foreach ($res as $r) { $brandname = $r['brand']==$prevb ? '' : $r['brand']; $storename = $r['store']==$prevs ? '' : $r['store']; $saveb = $r['brand']; $saves = $r['store']; array_shift($r); array_shift($r); if ($saveb <> $prevb) { if ($prevb) { $this->Cell($this->widths[5], 5, number_format($stotal, 2), 0, 1, $this->aligns[5]); $this->Cell(180 - $this->widths[5], 5, $prevb, 0, 0, 'R', 1); $this->Cell($this->widths[5], 5, number_format($btotal, 2), 'TB', 1, $this->aligns[5], 0); $stotal = $btotal = 0; $this->AddPage(); } } elseif ($saves <> $prevs) { $this->Cell($this->widths[5], 5, number_format($stotal, 2), 0, 1, $this->aligns[5]); $stotal = 0; } else $this->Ln(); $cells = [$brandname, $storename, $r['robot_num'], $r['date'], $r['total']]; foreach ($cells as $k => $v) { $this->Cell($this->widths[$k], 5, $v, 0, 0, $this->aligns[$k]); } $stotal += $r['total']; $btotal += $r['total']; $prevb = $saveb; $prevs = $saves; } if ($btotal) { $this->Cell($this->widths[5], 5, number_format($stotal, 2), 0, 1, 'R'); $this->Cell(180 - $this->widths[5], 5, $prevb, 0, 0, 'R', 1); $this->Cell($this->widths[5], 5, number_format($btotal, 2), 'TB', 1, 'R', 0); } } } $pdf = new PMpdf($conn, $_GET['ym'], $_GET['brand'], $_GET['state'], $_GET['store']); $pdf->AliasNbPages(); $pdf->SetFillColor(200); $pdf->SetDrawColor(120); $pdf->addPage(); $pdf->createSummaryReport(); $pdf->output(); ?> Can you please advise where I would need to alter the code to add-in the columns? Thank you for your time and suggestions. Let me know if I need to provide more information.
  10. do you want me to create a new thread? There is no deadline on this type of work either... I have started it, which I believe export to csv is quite easy... I will start new threads based on features I would need assistance with. we can close this signature thread as completed.
  11. Can you help me get a start on the concept I proposed? or do you have a better concept we could think about using?
  12. This statement is accurate
  13. So the code gets refactored providing a drop down of options the tech can choose from when observing situations. For example in the app within the phone, I believe there is a drop down that consist of different issues that can be selected from. Once selected, this option is reflected into the DB. I believe that part is achieved already. I believe one of the item numbers hold this information.
  14. Answer to Question 3 For comments on 1 and 2 your absolutely correct. Not sure how this would be approached code wise I agree, unless there is a better approach to all this.. Again, my concept was just that a concept. I am sure you get the idea of the goal by now regardless of how its approached or what the design looks like, its just making it work I basically so the clarity of information is alot more organized / clearer / and self explanatory.
  15. that worked to achieve what needs to be achieved would i need to update the PHP version? or can what we want to accomplish here be done in pre PHP 5.6?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.