Jump to content

bateman

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by bateman

  1. the glob was showing the file names, and the foreach you posted worked, now I just need to format it for my needs (the substr and such, which I've already tested). Right now I have it outputing to the screen, but once it's done, it's going to be a cron update page. Thank you
  2. So I've tried 6 different methods of pulling the data from the xml but each time I get nothing. I KNOW it's going to be something stupidly simple, but at the moment I'm stumpped. Here is the code I'm working with, and not that it's not complete as I still need to write in the glob code to limit the results to a single date. Edit: the print is commented because I used it to show me that the xml is reading. $date = date("Y-m-d"); //echo $fdate; $glob = "./fromdb/TimesheetBackup_" . $date. "*.xml"; foreach (glob ($glob) as $result) { echo $result; $xml = simplexml_load_file($result); $count = 0; //print_r($xml);// "<br> $xml"; foreach ($xml->tasks[] as $tasks): $starttimeb = $tasks['startDate']; $starttime = substr($starttimeb, -8, -1); $endtime = $tasks->key->endDate; echo $starttime; echo "<br> $endtime"; endforeach; } and a sample of the xml (end of a 48 record xml) <task> <taskId>f620bba390874d9fa41ddc4384ac0ba0</taskId> <projectId>7ab307cc59e84219b5e1b7b6215a7400</projectId> <description></description> <location>552 Pandora Ave, Victoria, BC V8W 1N7</location> <startDate>2014-01-02T13:15:00</startDate> <endDate>2014-01-02T16:33:00</endDate> <deleted>false</deleted> <endTime>0</endTime> <startTime>0</startTime> <lastUpdate>1388709184182</lastUpdate> <paid>0</paid> <feeling>0</feeling> </task> </tasks> </timesheet> I'm trying to get this to work with a xml that's created by the android app Timesheet. This is from it's auto backup system so I have no control over the output of the xml.
  3. That code there would work just fine, however, that's not the code your having issues with. It sounds like it's locked into the first image from the database. Are you trying to show just one image or a gallery?
  4. I've got a site running, and I would like to add up the totals from each location to one number, now I know it can be done, I just don't know how it'll work with my current code (see below) <table summary="" border="1" width="1100"> <tr> <td>Date</td> <!-- <td>Employee</td> --> <td>Store</td> <td>Customers</td> <td>Quotes</td> <td>Phone Calls</td> <td>Services In</td> <td>Services Out</td> <td>Invoices</td> <td>Conversion</td> <td>End of Day</td> <td>Emails</td> <td colspan=3>Notes</td> </tr> <? $x = 1; $y=1; $lastdate=0; while ($list = mysql_fetch_assoc($query)) { $dateadd = $list['dateadd']; $dateb = strtotime($list['dateadd']); $date = date("M j Y", $dateb);$date2 = date("Y-m-d", $dateb); $firstname = $list['firstname'];$lastname = $list['lastname'];$store = $list['store'];$customers = $list['cust'];$sales = $list['sales'];$invoices = $list['invoices'];$sin = $list['servin'];$sout = $list['servout'];$eod = $list['eod']; $phone = $list['phone']; $notes = $list['notes']; $emails = $list['emails']; if ($store == "1") {$storename = "Broadmead";} elseif ($store == "2") {$storename = "Duncan";} elseif ($store == "3") {$storename = "Surrey";} elseif ($store == "4") {$storename = "Sooke";} elseif ($store == "5") {$storename = "Nanaimo";} elseif ($store == "6") {$storename = "Shelbourne";} ?> <?php if ($lastdate == $date) { ?> <tr> <td width="125"><?=$date;?></td> <!-- <td width="125"><?=$firstname;?> <?=$lastname;?></td> --> <td width="100"><?=$storename;?></td> <td width="71"><?=$customers;?></td> <td width="71"><?=$sales;?></td> <td width="80"><?=$phone;?></td> <td width="80"><?=$sin;?></td> <td width="90"><?=$sout;?></td> <td width="71"><?=$invoices;?></td> <td width="71"><? $convbase = $sout+$sales; if (!$invoices==0 && !$customers==0) {$conv = $invoices / $customers * 100;} else {$conv=0;} echo money_format('%(#1n', $conv) . "\n"; ?>%</td> <td width="71">$<?echo money_format('%(#1n', $eod) . ""; ?><td> <td width="71"><?=$emails;?> </td> <td width="150"><?if (!$notes==NULL){echo $notes;} else {echo " ";}?></td> </tr> <?php } else { ?> <tr> <td colspan="9">Daily Total</td> <td><?echo money_format('%(#1n', $total) . ""; ?> </td> <td colspan="4"> </td> </tr> </table> <hr width="1100" align="left" color="0000ff"> <table summary="" border="1" width="1100"> <tr> <td width="125"><?=$date;?></td> <!-- <td width="125"><?=$firstname;?> <?=$lastname;?></td> --> <td width="100"><?=$storename;?></td> <td width="71"><?=$customers;?></td> <td width="71"><?=$sales;?></td> <td width="80"><?=$phone;?></td> <td width="80"><?=$sin;?></td> <td width="90"><?=$sout;?></td> <td width="71"><?=$invoices;?></td> <td width="71"><? $convbase = $sout+$sales; if (!$invoices==0 && !$customers==0) {$conv = $invoices / $customers * 100;} else {$conv=0;} echo money_format('%(#1n', $conv) . "\n"; ?>%</td> <td width="71">$<?echo money_format('%(#1n', $eod) . ""; ?><td> <td width="71"><?=$emails;?> </td> <td width="150"><?if (!$notes==NULL){echo $notes;} else {echo " ";}?></td> </tr> <?php } $lastdate = $date; } // end while ?> </table> Any help would be appreciated.
  5. the code is <?php $qty=$_POST['quantity']; $service=$_POST['service']; $reciept=$_POST['reciept']; if (service=SC1) {$desc="Hourly Service"; $price = "20";} elseif (service=SC2) {$desc="Hourly Service - Half hour"; $price = "10";} elseif (service=SC3) {$desc="Hourly Service - Extended area"; $price = "30";} elseif (service=SC5) {$desc="Virus Removal / Computer Cleanup"; $price = "40";} elseif (service=cl1) {$desc="Physical Cleaning of computer"; $price = "10";} elseif (service=ba1) {$desc="Data backup \$1 per 5gb"; $price = "1";} elseif (service=OS1) {$desc="Windows XP install"; $price = "50";} elseif (service=OS2) {$desc="Windows Vista install"; $price = "50";} elseif (service=OS3) {$desc="Windows 7 install"; $price = "50";} elseif (service=OS4) {$desc="Windows XP install - No disk"; $price = "50";} elseif (service=OS5) {$desc="Windows Vista install - No disk"; $price = "120";} elseif (service=OS6) {$desc="Windows 7 install - No disk"; $price = "250";} elseif (service=OS6) {$desc="Linux install"; $price = "50";} elseif (service=OS6) {$desc="Linux install - No disk"; $price = "60";} $total = $price * $qty; mysql_select_db($database_local, $local); { $sql=mysql_query("INSERT INTO service (qty, item, description, price, discount, total, reciept) VALUES('$qty','$service','$desc', '$price', '$discount', '$total', '$reciept') ") or die(mysql_error()); $result=mysql_query($sql); } I've looked it over myself and run a syntax checker, neither can find an error
×
×
  • 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.