Jump to content

honkmaster

Members
  • Posts

    34
  • Joined

  • Last visited

honkmaster's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Hi I have a query that returns the count of entries based on CURDATE(), it works for any dat in this month (April) but does not work for next month (May). I think it is something to do with CURDATE()+3 returns 2018-04-31 which should be 2018-05-01 This Works as Date is in April SELECT COUNT(Machine) FROM production WHERE Status = 'Confirmed' AND DATE(FROM_UNIXTIME(production.Required)) = CURDATE() This does not work as in May SELECT COUNT(Machine) FROM production WHERE Status = 'Confirmed' AND DATE(FROM_UNIXTIME(production.Required)) = CURDATE()+3
  2. Hi I need to display total hours and mins as this example "35 Hrs 23 Mins", issue I'm having is after 24 it goes back to zero I'm storing the time as follows 127380 (seconds) I should get 35:23 but I'm getting 59:23 ??? Any ideas would help $date = '127380'; $minsec = gmdate("i:s", $date); $hours = gmdate("d", $date)*24 + gmdate("H", $date); echo $time = $hours . ':' . $minsec;
  3. honkmaster

    SQL count help

    Hi, I have an issue and hope someone can point me in the right direction. I have a table called production Table production Id Job Company Status — —— ——— ——— 123 001 Test 1 Active 123 002 Test 1 Active 123 003 Test 1 Active 123 004 Test 1 Complete 123 005 Test 1 Active 123 006 Test 1 Complete 456 001 Test 2 Complete 456 002 Test 2 Complete 456 003 Test 2 Active 456 004 Test 2 Complete 456 005 Test 2 Active 456 006 Test 2 Complete 789 001 Test 3 Complete 789 002 Test 3 Active 789 003 Test 3 Active 789 004 Test 3 Active 789 005 Test 3 Active 789 006 Test 3 Active I'm trying to run a query that returns the following Company Active Complete Test 1 4 2 Test 2 2 4 Test 3 5 1 So its DISTINCT Id and counting the different status and return as above Any help would be great as I have been trying most of the day but without success Cheers Chris
  4. Ok I worked it out, under fitbox i had used true, you can use 2 charters here 'CM' the center and middle $fitbox (mixed) If not false scale image dimensions proportionally to fit within the ($w, $h) box. $fitbox can be true or a 2 characters string indicating the image alignment inside the box. The first character indicate the horizontal alignment (L = left, C = center, R = right) the second character indicate the vertical algnment (T = top, M = middle, B = bottom).
  5. Hi, Im have a trouble understand how I align the image to centre vertical and horizontally any help would be great, Cheers Chris // Image Box $pdf->setCellPaddings(0, 0, 0, 0); $pdf->SetFillColor(255, 255, 255); $pdf->SetDrawColor(0, 0, 0); $pdf->Rect(10, 117, 188, 137, 'DF'); $pdf->Image('Upload/94428_075_10% Data Capture cards.jpg', 15, 122, 180, 125, 'JPG', '', '', false, 300, 'C', false, false, 0, true, false, false);
  6. Hi, i'm having a hard time with this one, I need to create a PDF with the results from a query into a html table, all I'm getting is the first row when I should get 6!! I'm quite new to TCPDF so any help would be great. Code below $pdf = new TCPDF(); // add a page $resolution= array(210, 297); // set margins $pdf->SetAutoPageBreak(false, 0); $pdf->setCellMargins(0, 0, 0, 0); $pdf->setCellPaddings(0, 0, 0, 0); // remove default header/footer $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); // get data from users table $storeid = $row_rsStoreID['Allocation_StoreId']; $formcode = $row_rsStoreID['Allocation_FormCode']; $qty = $row_rsStoreID['Allocation_Quantity']; $store = $row_rsStoreID['Allocation_Name']; // ----------------------------------------------------------------------------- $pdf->Write(10,10,0, 'Example of HTML tables', '', 0, 'L', true, 0, false, false, 0); $pdf->SetFont('Helvetica', '', 12); if($totalRows_rsStoreID > 0) { while($row_rsStoreID = mysql_fetch_assoc($rsStoreID,MYSQL_ASSOC)) { $tbl = <<<EOD <table border="1" cellpadding="5" cellspacing="0"> <tr> <td>$storeid</td> <td>$formcode</td> <td>$qty</td> </tr> </table> EOD; $pdf->writeHTML($tbl, true, false, false, false, ''); // ----------------------------------------------------------------------------- //Close and output PDF document $pdf->Output('Test', 'I');
  7. honkmaster

    TCPDF

    Worked a treat, thanks very much for help and pointing me in the right direction, Cheers
  8. honkmaster

    TCPDF

    Ok, if I'm posting 219, 200 19 how do I split that into 3 values from the one post? Cheers
  9. honkmaster

    TCPDF

    Set fill expect the following SetFillColor(219, 200, 19) for RGB or SetFillColor(0, 50, 50, 0) for CMYK I have posted both from form as $pdf->SetFillColor($getcolour); neither work? Cheers for reply
  10. honkmaster

    TCPDF

    Hi I'm stuck with an issue i can't work out. I'm using php and TCPDF to create a pdf label. The user uses a simple form and selects the colour the label needs to be. Problem I have got is no matter what I post TCPDF does not pick up the colour variable. In the below code the SetFillColour works if i put RGB or CMYK info in direct but not if I post it so $pdf->SetFillColor(219, 200, 19); works but if i post from a form $pdf->SetFillColor($getcolour); it does not??? Any ideas or help would be grateful, Cheers $getcolour = $_POST['colour'];// Format Store ID Block $pdf->StartTransform(); $pdf->SetFont('Helvetica', 'B', 40); $pdf->setCellPaddings(0, 0, 0, 0); $txt = $storeid; $pdf->SetXY(1,49); $pdf->Rotate(90); $pdf->SetFillColor($getcolour); $pdf->MultiCell(48, 0, $txt."n", 0, 'C', 1, 1, '' ,'', true); $pdf->StopTransform();
  11. This is code i'm using now, only the returned unix date is incorrect? $wholedate = $_POST['duedate'];$date_array = explode('.', $wholedate);$test = mktime(0,0,0,$date_array[1],$date_array[2],$date_array[0]);echo $test;echo '<br>';echo date('Y-m-d', $test); //Check if timestamp returns wanted date format
  12. the issue is when you convert that time stamp back it is in correct, i.e. i start by converting 2013-01--10 to a timestamp 1354233600, when you convert it back it = 2012.11.30 Cheers Chris
  13. Thanks for response and sorry for not stating the issue, when I run the code and check the unix date I get 1354233600 = 2012.11.30 ?? and not 2013-01-10 as expected. Cheers Chris
  14. Hi I have the following code I think the date format is wrong. I'm posting a date from a form as 2013-01-10, before I post it to mysql I want to convert it to unix format I'm still a beginner so need a help Cheers Chris $wholedate = $_POST['duedate'];$date_array = explode('.', $wholedate);$test = mktime(0,0,0,$date_array[1],$date_array[0],$date_array[2]);
  15. honkmaster

    Comparing Dates

    Hi, Any help would be great I have the following code which is looking at two dates, due date and today. <?php date_default_timezone_set('Europe/London');$now = time();if ($row_rsReleaseQue['duedate'] < date('d-m-Y',$now)) { echo '<tr class="tableBody3">';} else { echo '<tr class="tableBody1">';}?> I want to change the background colour of the line in my table based on the due date. < less that todays date = Red (tableBody3)== equal to today = Orange (tableBody2)> greater than today = Green (tableBody1) Cheers Chris
×
×
  • Create New...