Ejemplo n.º 1
0
    if ($this_slice) {
        $this_slice .= '&';
    }
    $this_slice .= 'slice_producer=' . $_GET['slice_producer'];
}
// Get the retail and wholesale markup amounts
$query = '
  SELECT
    delivery_date,
    producer_markdown,
    wholesale_markup,
    retail_markup
  FROM
    ' . TABLE_ORDER_CYCLES . '
  WHERE
    delivery_id = "' . mysql_real_escape_string(ActiveCycle::delivery_id_next()) . '"';
$result = @mysql_query($query, $connection) or die(mysql_error());
if ($row = mysql_fetch_array($result)) {
    $delivery_date = date("F j, Y", strtotime($row['delivery_date']));
    $producer_markdown = $row['producer_markdown'] / 100;
    $retail_markup = $row['retail_markup'] / 100;
    $wholesale_markup = $row['wholesale_markup'] / 100;
}
// Get the products meeting the requested criteria
$query = '
  SELECT
    ' . NEW_TABLE_PRODUCTS . '.*,
    ' . NEW_TABLE_PRODUCTS . '.product_fee_percent / 100 AS product_fee_percent,
    ' . TABLE_PRODUCER . '.business_name,
    ' . TABLE_PRODUCER . '.producer_fee_percent / 100 AS producer_fee_percent,
    ' . TABLE_SUBCATEGORY . '.subcategory_name,
Ejemplo n.º 2
0
        sort($completion_array, SORT_NUMERIC);
        $display .= '
      <tr>
        <td colspan="3">
          <div class="completion_list">
          ' . implode('<br>', $completion_array) . '
          </div>
        </td>
      </tr>';
    }
    $display .= '
      <tr>
        <td align="left" style="border-bottom:1px solid #000;">
          <input type="hidden" name="repeat_id" value="' . $row->repeat_id . '">
          <input type="hidden" name="new_order_last_added" value="' . ActiveCycle::delivery_id_next() . '">
          ' . ($row->order_last_added < ActiveCycle::delivery_id_next() ? '<input class="button" type="submit" name="action" value="Post orders"><br><br>' : '') . '
        </td>
        <td align="right" colspan="2" style="border-bottom:1px solid #000;">
          <input class="button" type="submit" name="action" value="Update settings"><br><br>
        </td>
      </tr>
    </form>';
}
// Get the next repeat_id for adding a new repeating item
$display .= '
    <form action="' . $_SERVER['SCRIPT_NAME'] . '" method="post">
      <tr>
        <td rowspan="3" width="50%" valign="top" class="add"><strong>Add new item</strong><br>Use this section to add a new
        repeating item.  The cost of the item will be charged on the invoice only the first time the item is ordered.  Each
        subsequent invoice for the number of &quot;Repeat after first order&quot; times, will show the item at zero cost.  This
        is how the system can correctly count repeats.</td>
Ejemplo n.º 3
0
 private static function get_next_delivery_info()
 {
     if (self::$next_query_complete === false) {
         global $connection;
         // Set up for pulling only order cycles appropriate to the current customer_type permissions
         // Allow "orderex" direct access to all order cycles
         $customer_type_query = CurrentMember::auth_type('orderex') ? '1' : '0';
         if (CurrentMember::auth_type('member')) {
             $customer_type_query .= '
           OR customer_type LIKE "%member%"';
         }
         if (CurrentMember::auth_type('institution')) {
             $customer_type_query .= '
           OR customer_type LIKE "%institution%"';
         }
         // Set the default "where condition" to be the cycle that opened most recently
         // Do not use MySQL NOW() because it does not know about the php timezone directive
         $now = date('Y-m-d H:i:s', time());
         $query = '
             (SELECT
               date_open,
               date_closed,
               delivery_date,
               delivery_id,
               producer_markdown / 100 AS producer_markdown,
               retail_markup / 100 AS retail_markup,
               wholesale_markup / 100 AS wholesale_markup,
               1 AS using_next
             FROM
               ' . TABLE_ORDER_CYCLES . '
             WHERE
               date_closed > "' . $now . '"
               AND (' . $customer_type_query . ')
             ORDER BY
               date_closed ASC
             LIMIT 0,1)
           UNION
             (SELECT
               date_open,
               date_closed,
               delivery_date,
               delivery_id,
               producer_markdown / 100 AS producer_markdown,
               retail_markup / 100 AS retail_markup,
               wholesale_markup / 100 AS wholesale_markup,
               0 AS using_next
             FROM
               ' . TABLE_ORDER_CYCLES . '
             WHERE
               date_open < "' . $now . '"
               AND (' . $customer_type_query . ')
             ORDER BY
               date_open DESC
             LIMIT 0,1)';
         $result = @mysql_query($query, $connection) or die(debug_print("ERROR: 863024 ", array($query, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
         if ($row = mysql_fetch_object($result)) {
             self::$date_open_next = $row->date_open;
             self::$date_closed_next = $row->date_closed;
             self::$delivery_date_next = $row->delivery_date;
             self::$delivery_id_next = $row->delivery_id;
             self::$producer_markdown_next = $row->producer_markdown;
             self::$retail_markup_next = $row->retail_markup;
             self::$wholesale_markup_next = $row->wholesale_markup;
             self::$using_next = $row->using_next;
             self::$next_query_complete = true;
         }
     }
 }