Ejemplo n.º 1
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;
         }
     }
 }
Ejemplo n.º 2
0
      </td>
    </tr>
    <tr' . $norm_bg . '>
      <td>' . format_help_link('inventory_pull') . 'Inventory&nbsp;Rate</a><br>' . format_help_link('inventory_id') . 'Inventory&nbsp;Name</a></td>
      <td>Each item purchased will pull <input type="text" name="inventory_pull" value="' . $product_info['inventory_pull'] . '" size=3 maxlength="6"> unit(s) of...<br>
      ' . $inventory_select . '<span id="inventory_pull"> from inventory.</span>
        </div>
      </td>
    </tr>
    <tr' . $norm_bg . '>
      <td>' . format_help_link('unit_price') . 'Price</a><br>' . format_help_link('pricing_unit') . 'Pricing&nbsp;Unit</a></td>
      <td>
        <table>
          <tr>
            <td style="padding:0 1em;" align="right">' . $alert5 . '<b>Producer&nbsp;Price:</b></td>
            <td><nobr>$ </b><input class="disabled" type="text" id="unit_price_prdcr" name="unit_price" value="' . number_format($show_unit_price * (1 - ActiveCycle::producer_markdown_next()), 2) . '" size="8" maxlength="8" disabled></nobr></td>
            <td style="padding:0 1em;" rowspan="3"><b>per ' . $alert5a . '<input name="pricing_unit" size="12" maxlength="12" value="' . $product_info['pricing_unit'] . '"></b><br>
            <font size="-2">(Use singular, not plural; e.g. pound instead of pounds, loaf instead of loaves, ox instead of oxen, etc.)</font></td>
          </tr>
          <tr>
            <td style="padding:0 1em;" align="right">' . $alert5 . '<b>Coop&nbsp;Price:</td>
            <td><nobr>$</b> <input type="text" id="unit_price_coop" name="unit_price" value="' . number_format($show_unit_price, 3) . '" size=8 maxlength="8" onKeyUp="updatePrices()" onChange="document.getElementById("unit_price_coop").value=(document.getElementById("unit_price_coop").value*1).toFixed(2)"></nobr></td>
          </tr>
          <tr>
            <td style="padding:0 1em;" align="right">' . $alert5 . '<b>Retail&nbsp;Price:</b></td>
            <td><nobr>$</b> <input class="disabled" type="text" id="unit_price_cust" name="unit_price" value="' . number_format($show_unit_price * (1 + (SHOW_ACTUAL_PRICE ? ActiveCycle::retail_markup_next() : 0)) * (1 + $product_info['product_fee_percent'] / 100 + $product_info['subcategory_fee_percent'] / 100 + $product_info['producer_fee_percent'] / 100), 2) . '" size="8" maxlength="8" disabled></nobr></td>
          </tr>';
if (INSTITUTION_WINDOW > 0) {
    $display .= '
          <tr>
            <td style="padding:0 1em;" align="right">' . $alert5 . '<b>Wholesale&nbsp;Price:</b></td>
Ejemplo n.º 3
0
        </div>' : '') . '
          ' . $display . '
      </td>
    </tr>
  </table>
  </div>';
$page_title_html = '<span class="title">' . $business_name . '</span>';
$page_subtitle_html = '<span class="subtitle">Edit Product' . ($product_id ? ' #' . $product_id : '') . '' . ($product_version ? '-' . $product_version : '') . '</span>';
$page_title = $business_name . ': Edit Product';
$page_tab = 'producer_panel';
$page_specific_javascript = '
  <script type="text/javascript" src="javascript_popup.js"></script>
  <script type="text/javascript">
  function updatePrices()
    {
    document.getElementById("unit_price_prdcr").value=(document.getElementById("unit_price_coop").value*' . (1 - ActiveCycle::producer_markdown_next()) . ').toFixed(2);
    document.getElementById("unit_price_cust").value=(document.getElementById("unit_price_coop").value*' . (1 + (SHOW_ACTUAL_PRICE ? ActiveCycle::retail_markup_next() : 0)) . '*(1+(document.getElementById("product_fee_percent").value/100)+' . ($subcat_adjust_fee + $producer_adjust_fee) . ')).toFixed(2);
    document.getElementById("unit_price_institution").value=(document.getElementById("unit_price_coop").value*' . (1 + (SHOW_ACTUAL_PRICE ? ActiveCycle::wholesale_markup_next() : 0)) . '*(1+(document.getElementById("product_fee_percent").value/100)+' . ($subcat_adjust_fee + $producer_adjust_fee) . ')).toFixed(2);
    }
  </script>';
$page_specific_css = '
<style type="text/css">
.normal_row {
  background-color:#ddd;
  }
.random_wt_row {
  background-color:#bbd;
  }
.control_row {
  background-color:#ddd;
  }