label_cell($end); label_cell($last_sent); edit_button_cell("Edit" . $myrow["id"], _("Edit")); delete_button_cell("Delete" . $myrow["id"], _("Delete")); end_row(); } end_table(); end_form(); echo '<br>'; //------------------------------------------------------------------------------------------------- start_form(); start_table(TABLESTYLE2); if ($selected_id != -1) { if ($Mode == 'Edit') { //editing an existing area $myrow = get_recurrent_invoice($selected_id); $_POST['description'] = $myrow["description"]; $_POST['order_no'] = $myrow["order_no"]; $_POST['debtor_no'] = $myrow["debtor_no"]; $_POST['group_no'] = $myrow["group_no"]; $_POST['days'] = $myrow["days"]; $_POST['monthly'] = $myrow["monthly"]; $_POST['begin'] = sql2date($myrow["begin"]); $_POST['end'] = sql2date($myrow["end"]); $_POST['last_sent'] = $myrow['last_sent'] == "0000-00-00" ? "" : sql2date($myrow["last_sent"]); } hidden("selected_id", $selected_id); } text_row_ex(_("Description:"), 'description', 50); templates_list_row(_("Template:"), 'order_no'); customer_list_row(_("Customer:"), 'debtor_no', null, " ", true);
$from = sql2date($myrow["begin"]); } else { $from = sql2date($myrow["last_sent"]); } return $from; } if (!isset($_POST['date'])) { $_POST['date'] = Today(); } $id = find_submit("create"); if ($id != -1) { $Ajax->activate('_page_body'); $date = $_POST['date']; if (is_date_in_fiscalyear($date)) { $invs = array(); $myrow = get_recurrent_invoice($id); $from = calculate_from($myrow); $to = add_months($from, $myrow['monthly']); $to = add_days($to, $myrow['days']); if ($myrow['debtor_no'] == 0) { $cust = get_cust_branches_from_group($myrow['group_no']); while ($row = db_fetch($cust)) { $invs[] = create_recurrent_invoices($row['debtor_no'], $row['branch_code'], $myrow['order_no'], $myrow['id'], $date, $from, $to); } } else { $invs[] = create_recurrent_invoices($myrow['debtor_no'], $myrow['group_no'], $myrow['order_no'], $myrow['id'], $date, $from, $to); } if (count($invs) > 0) { $min = min($invs); $max = max($invs); } else {