Jump to content

SH29489

New Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About SH29489

  • Rank
    Newbie

Recent Profile Visitors

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

  1. Thanks for getting back to me. I now have this working!
  2. OK, so I just realised I would be doubling up data so changed it a little and included the Schema below. tbl_invoice_numbers invoice_number (auto_increment) tbl_billable_lines billable_lined_id (auto_increment) product_id (int) user_id (int) charge (int) invoice_number (int) date_processed (datetime) What I am thinking now is that the tbl_billable_lines has all the information we need to I can add the invoice_number to this. The tbl_invoice_numbers table would purely be used to keep track of the invoice numbers so we can then insert a new ID, and get this ID and update this on the tbl_billable_lines. The problem I am having is the running through each user and finding all of their tbl_billable_lines and then adding a new invoice ID to the billable lines. the idea is that I will be able to pull the invoice numbers where the date_processed is empty and then pull all off the billable lines into one pdf to email. Kind regards,
  3. Hi Guys, Looking for a bit of coding help with a query I am building. I have two tables, one contains all of the billable items that have been used by the specific user and the charges for said items and the other will contain the userID and a generated invoiceID and the BillableLine. What I want to do now is bill them for the items, so the script will loop through all the charges in the billable items table and populate a second table with the grouped charges so everything can then be fpdf'd over from the cron. The problem I am facing is that I need to create an invoice ID and then use this ID for the invoice lines to th at I will be able to report using the invoiceID for each user. include("../includes/config.php"); // Get's the last ID from the dsn_invoice_id field (Not an auto increment) $sql2 = "SELECT dsn_invoice_id FROM DSN_invoices ORDER BY chargeID DESC LIMIT 1"; $result2 = mysqli_query($db, $sql2);while($row2 = mysqli_fetch_assoc($result2)) { $dsn_invoice_id = $row2["dsn_invoice_id"];} // Get the list of charges / billale items $sql1 = "SELECT userID, chargeID FROM posted_charges WHERE charge_processed = '0'"; $result1 = mysqli_query($db, $sql1); while($row1 = mysqli_fetch_assoc($result1)) { $userID = $row1["userID"];$chargeID = $row1["chargeID"]; // Insert the item, with an increment of + 1. $sqlIns = "INSERT INTO dsn_invoice_id (dsn_invoice_id, userID, ChargeID) VALUES ('". ($currentnumber + 1) ."','$userID','$chargeID')"; } Thanks for taking the time to read this! Kind regards,
×
×
  • 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.