Topic: Invoice by order created (Maybe) Deliveries by order created (what???)

I find it hard to understand why the default reporting is by order created for invoices and delivery notes. Ok, maybe you go about your day entering some invoices then printing in batches. but couldn't you just click print right after creation if that is how you work?

Most people batch these things out by the day, most certainly deliveries. ie. You go about your work week or month scheduling deliveries to be efficient. then batch print all the delivery notes for the day. "Here you go Timmy here is your stops/deliveries for the day".

Then depending on what deliveries were completed you would invoice. so lets say Timmy comes back and didn't do some jobs. He gave you that reason about not feeling to good again. So you move the deliveries to a future date invoice the ones that were completed for the day and batch print or email them.

Maybe you mail invoices by date as well the whole month at once and make bills due on a date of the month. I can see many reasons why you would do date and not due order created.

What do you guys think?

Re: Invoice by order created (Maybe) Deliveries by order created (what???)

easy for invoices

reports_main.php                     (change the array)

$reports->addReport(RC_CUSTOMER, 107, _('Print &Invoices'),
    array(    //_('From') => 'INVOICE',       // removed for date
            //_('To') => 'INVOICE',         // removed for date  
            _('Start Date') => 'DATEBEGINM',    // added for date
            _('End Date') => 'DATEENDM',        // added for date
            _('Currency Filter') => 'CURRENCY',
            _('email Customers') => 'YES_NO',
            _('Payment Link') => 'PAYMENT_LINK',
            _('Comments') => 'TEXTBOX',
            _('Customer') => 'CUSTOMERS_NO_FILTER',
            _('Orientation') => 'ORIENTATION'
));

rep107.php         (change the function)

function get_invoice_range($from, $to, $currency=false)
{
    global $SysPrefs;
//--- new for date search instead of     
    $fromdate = date2sql($from);
    $todate = date2sql($to);
//---- End new stuff    


    $ref = ($SysPrefs->print_invoice_no() == 1 ? "trans_no" : "reference");

    $sql = "SELECT trans.trans_no, trans.reference";

//  if($currency !== false)
//        $sql .= ", cust.curr_code";

    $sql .= " FROM ".TB_PREF."debtor_trans trans 
            LEFT JOIN ".TB_PREF."voided voided ON trans.type=voided.type AND trans.trans_no=voided.id";

    if ($currency !== false)
        $sql .= " LEFT JOIN ".TB_PREF."debtors_master cust ON trans.debtor_no=cust.debtor_no";

    $sql .= " WHERE trans.type=".ST_SALESINVOICE
        ." AND ISNULL(voided.id)"
     //    ." AND trans.trans_no BETWEEN ".db_escape($from)." AND ".db_escape($to) //removed old
         ." AND trans.tran_date>='$fromdate'" // added this
        ." AND trans.tran_date<='$todate'";     //added this        

    if ($currency !== false)
        $sql .= " AND cust.curr_code=".db_escape($currency);

    $sql .= " ORDER BY trans.tran_date, trans.$ref";

    return db_query($sql, "Cant retrieve invoice range");
}

more difficult for deliveries