Jump to content

Butterbean

Members
  • Content Count

    70
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Butterbean

  • Rank
    Regular Member
  1. If I already have PHP, IIS and DB on the existing system and want to have that data all moved to another system, can I use web deploy 3.5 to do this merge?
  2. Greetings all. I have a small server on a Windows 7 Home Premium machine (32 bit). I am upgrading it to a new server (Lenovo think server 64 bit). I was hoping there was an easy way to migrate IIS 6 files from one server to another. I am not very versed in this. I was looking for a way to just copy the files to a thumb drive and then back to the new machine but it does not seem that simple. Any thoughts?
  3. So, I'm trying to fix this issue but really don't have the knowledge to do so. I am enrolled in a php course but for now I could really use your help. Below is what I've attempted to try to fix the issue. Can you please tell me what I have done wrong so far? I know there is a lot to clean up to make this code faster to query and more resilient and I will get to that soon. For now, I'm focusing on the issue when I reach 10M. Please see below. <?php $sql = ";WITH TOTAL_KWH_WINTER AS ( SELECT CONVERT(VARCHAR(10),cdate,111)AS trans_date, datepart(hh, cdate) as trans_hour, comm_id, MIN((total_energy_a+total_energy_b+total_energy_c)/100) AS minUsage, MAX((total_energy_a+total_energy_b+total_energy_c)/100) AS maxUsage, meter_multiplier FROM [radiogates].[dbo].[purge_data] LEFT OUTER JOIN [radiogates].[dbo].[ops_invoice] on [radiogates].[dbo].[purge_data].[comm_id] = [radiogates].[dbo].[ops_invoice].[meter_id] where comm_id='$comm_id'and meter_multiplier is not null group by comm_id, CONVERT(VARCHAR(10),cdate,111), datepart(hh, cdate), meter_multiplier ) SELECT *, datepart(weekday, trans_date) as trans_date_day, datepart(month, trans_date) as trans_date_month, if ((maxUsage - minUsage)*meter_multiplier)<0:{ ((maxUsage - minUsage)+10000000)*meter_multiplier); }else { ((maxUsage - minUsage)*meter_multiplier)as totalUsage} FROM TOTAL_KWH_WINTER where datepart(weekday, trans_date) IN ('1', '2', '3', '4', '5', '6', '7') AND DATEPART(MONTH, trans_date) IN ('10','11','12','1','2','3','4') and trans_date BETWEEN '$startdate2 00:00:01' AND '$enddate2 24:00:00' "; $query = sqlsrv_query($conn, $sql);if ($query === false){ exit("<pre>".print_r(sqlsrv_errors(), true));}while ($row = sqlsrv_fetch_array($query)){ $sumUsageKWH += $row[totalUsage];}sqlsrv_free_stmt($query);?>
  4. Thank you for referring to that topic. After revisiting it, I think I understand now.
  5. Hello everyone, <?php $sql = ";WITH TOTAL_KWH_WINTER AS ( SELECT CONVERT(VARCHAR(10),cdate,111)AS trans_date, datepart(hh, cdate) as trans_hour, comm_id, MIN((total_energy_a+total_energy_b+total_energy_c)/100) AS minUsage, MAX((total_energy_a+total_energy_b+total_energy_c)/100) AS maxUsage, meter_multiplier FROM [radiogates].[dbo].[purge_data] LEFT OUTER JOIN [radiogates].[dbo].[ops_invoice] on [radiogates].[dbo].[purge_data].[comm_id] = [radiogates].[dbo].[ops_invoice].[meter_id] where comm_id='$comm_id'and meter_multiplier is not null group by comm_id, CONVERT(VARCHAR(10),cdate,111), datepart(hh, cdate), meter_multiplier ) SELECT *, datepart(weekday, trans_date) as trans_date_day, datepart(month, trans_date) as trans_date_month, ((maxUsage - minUsage)*meter_multiplier) as totalUsage FROM TOTAL_KWH_WINTER where datepart(weekday, trans_date) IN ('1', '2', '3', '4', '5', '6', '7') AND DATEPART(MONTH, trans_date) IN ('10','11','12','1','2','3','4') and trans_date BETWEEN '$startdate2 00:00:01' AND '$enddate2 24:00:00' "; $query = sqlsrv_query($conn, $sql);if ($query === false){ exit("<pre>".print_r(sqlsrv_errors(), true));}while ($row = sqlsrv_fetch_array($query)){ $sumUsageKWH += $row[totalUsage];}sqlsrv_free_stmt($query);?> **************For whatever reason, my browser will not let me put this code where it needs to go, so its up top. Sorry for the inconvenience.************* My concern are code lines 4 through 15 I have PHP code that queryies MSSQL for data called kilowatt hours (kWh), set in a combination of three columns. kWh is set into the db table once every minute and it a value that starts at zero (0) at the beginning of the meters life, then continues until it reaches 10,000,000 before resetting back to zero (0). This happens over weeks, months or years, but it does happen. The code I have listed here makes no consideration of this reset. Since we are alsways querying between a start date and a stop date, we need to know the kWh usage between that period. So, we used maxUsage - minUsage and called that the totalUsage. That works great until the data reset at 10M. At that point, max usage will be some value (ex. 1 kWh), where min usage will be some value (ex. 9,999,999 kWh). the system breaks down at that point. I need to find an algorithm that helps me take into consideration this rolling number set. Thanks for any help!
  6. They would have to be created on the fly. The page where I'm including the buttons is in html. The one I'm mostly concerned with is the CSV file. I need to find a way where every time an html invoice is created, a NACHA certified file is created as a CSV file, then emailed to the customer. I think I can get started on this but its gonna be rocky.
  7. Somebody? Anybody? Hello ello o oo o o oo o oo o o [echoes]
  8. I have a button that brings up my systems printer.... <button onClick="window.print()">Print this page</button> I'm trying to find a way to do the same thing but giving me the ability to save-as to my CPU. What would be nice is if I could have separate buttons to save-as a PDF and one for CSV. Each would automatically save to a file, with a comfirmation that its saved. The location would be coded in PHP for the desired format, and all the user has to do is click the button and it is placed in the appropriate folded. is this possible and easy to do across ie, firefox and chrome? Thanks for any direction. .
  9. Based on what I see, I tried this... no luck. $query = sqlsrv_query($conn, $sql);if ($query === false){ exit("<pre>".print_r(sqlsrv_errors(), true));}while ($row = sqlsrv_fetch_array($query)){ echo "<tr> <td><a href='view_invoice.php?meter_id=$meter_id&subaccount=$subaccount&start_date=$row[start_date]'>$row[meter_id]</a></td> <td>" . date("F Y",strtotime($row['start_date'])) . "+1 month") . "</td><td>$row[invoice_no]</td><td>" . date_format($row['invoice_date'],'Y-m-d') . "</td><td><a href='approve_payment.php?meter_id=$meter_id&subaccount=$subaccount&start_date=$row[start_date]'>Pay Invoice</a></td> </tr>";}sqlsrv_free_stmt($query); ?> $query = sqlsrv_query($conn, $sql);if ($query === false){ exit("<pre>".print_r(sqlsrv_errors(), true));}while ($row = sqlsrv_fetch_array($query)){ echo "<tr> <td><a href='view_invoice.php?meter_id=$meter_id&subaccount=$subaccount&start_date=$row[start_date]'>$row[meter_id]</a></td> <td>" . date("F Y",strtotime($row['start_date'])) . "+1 month") "</td><td>$row[invoice_no]</td><td>" . date_format($row['invoice_date'],'Y-m-d') . "</td><td><a href='approve_payment.php?meter_id=$meter_id&subaccount=$subaccount&start_date=$row[start_date]'>Pay Invoice</a></td> </tr>";}sqlsrv_free_stmt($query); ?>
  10. Thank you for your help. In this case, 'start_date' is a date that is manually entered into php to query mssql for data. I'm using this start date in addition to this purpose to signify the month the bill was produced (which is at the end the 30 days that was queried by the bill. Unfortunately, i did not create an end_date..so now I need to add 1 month to the queried 'start_date' if that makes sense. The purpose for what Im doing it simply to prevent confusion in saving bill copies. Currently we are calling a bill with a start_date of January...a January bill. We really need to call it a February bill. Will this still work in this situation?
  11. I see why you would think that, however, if there is no data, the metering sends an empty packet with zero values. So there will be a row in mssql that has all zeros. Occasionally there is no row of data sent by the EMS, so if it doesnt exist, it doesnt mean that they were using zero energy, it just means that the data never reached the server ( in the timestamped period), so we look at the next timestamps. In that event I need a backup plan to look forward then backward until it finds data (that data can even be zero). This system never stops sending data, so if it doesnt make it to the server, there is some reason (something blocking the 900 MHz, internet down or electric down).
  12. I am looking for a way to have my 'start_date', echo ('start_date' + 1 month). I am looking at the line that reads .... date("F Y",strtotime($row['start_date'])). Does anyone have a suggestion. The date format read, July 2014 or alphabetical full month, numerical full year. Thank you in advance. <?php $query = sqlsrv_query($conn, $sql);if ($query === false){ exit("<pre>".print_r(sqlsrv_errors(), true));}while ($row = sqlsrv_fetch_array($query)){ echo "<tr> <td><a href='view_invoice.php?meter_id=$meter_id&subaccount=$subaccount&start_date=$row[start_date]'>$row[meter_id]</a></td> <td>" . date("F Y",strtotime($row['start_date'])) . "<td>$row[invoice_no]</td><td>" . date_format($row['invoice_date'],'Y-m-d') . "<td>$row[amount_paid]</td>" . "<td>$row[payment_date]</td>" . "<td>$row[check_number]</td>" ;}sqlsrv_free_stmt($query); ?>
  13. I have an energy monitoring system that I am building. This EMS gathers data once per minute and drops that data into a mssql db. I have php set up to interpret the values and allow the customer to query the mssql for data for a peak value within a 15 minute interval. The user enters the 15 minute interval into the web app, along with the timeperiod (15 minute interval in question) example (2014-10-16 at 07:30:00 - 07:44:59 ). Sometimes there is no data in that interval because there was nothing reported (due to power outages or internet connection issue). When there is no data to report, there is not even an entry row set in mssql, therefore the time and date it is querying is not present. I am trying to find a way that if php queries mssql and the row that is queried does not exist, have php look forward than backwards simultaneously until it finds any value (it can even be a zero as long as its a value) to report. I would think I could cover any situation including a major power outage by looking forward three (3) days and back three (3) days. I'm not sure where to even start with something like this. Does anyone have a suggestion on how to start?
×
×
  • 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.