<td>' . format_help_link('unit_price') . 'Price</a><br>' . format_help_link('pricing_unit') . 'Pricing Unit</a></td> <td> <table> <tr> <td style="padding:0 1em;" align="right">' . $alert5 . '<b>Producer 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 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 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 Price:</b></td> <td><nobr>$</b> <input type="text" id="unit_price_institution" name="unit_price" value="' . number_format($show_unit_price * (1 + (SHOW_ACTUAL_PRICE ? ActiveCycle::wholesale_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>'; } $display .= ' </table> </td> </tr> <tr' . $norm_bg . '> <td>' . format_help_link('ordering_unit') . 'Ordering Unit</a></td> <td>
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; } } }
$row['cost_multiplier'] = $row['minimum_weight'] * $row['unit_price'] * ($row['basket_quantity'] - $row['out_of_stock']); break; case 'MAX': $row['cost_multiplier'] = $row['maximum_weight'] * $row['unit_price'] * ($row['basket_quantity'] - $row['out_of_stock']); break; } $row['weight_needed'] = true; } elseif ($row['random_weight'] == 1) { $row['cost_multiplier'] = $row['total_weight'] * $row['unit_price']; } else { $row['cost_multiplier'] = ($row['basket_quantity'] - $row['out_of_stock']) * $row['unit_price']; } $row['producer_adjusted_cost'] = round($row['cost_multiplier'], 2) - round($row['producer_customer_adjust_fee'] * $row['cost_multiplier'], 2) - round($row['producer_subcat_adjust_fee'] * $row['cost_multiplier'], 2) - round($row['producer_producer_adjust_fee'] * $row['cost_multiplier'], 2); $row['customer_adjusted_cost'] = round($row['cost_multiplier'], 2) + round($row['customer_customer_adjust_fee'] * $row['cost_multiplier'], 2) + round($row['customer_product_adjust_fee'] * $row['cost_multiplier'], 2) + round($row['customer_subcat_adjust_fee'] * $row['cost_multiplier'], 2) + round($row['customer_producer_adjust_fee'] * $row['cost_multiplier'], 2); // Following values are for generalalized -- not-logged-in calculations $row['retail_unit_cost'] = round($row['unit_price'], 2) + (PAYS_CUSTOMER_FEE == 'customer' ? round(ActiveCycle::retail_markup_next() * $row['unit_price'], 2) : 0) + round($row['customer_product_adjust_fee'] * $row['unit_price'], 2) + round($row['customer_subcat_adjust_fee'] * $row['unit_price'], 2) + round($row['customer_producer_adjust_fee'] * $row['unit_price'], 2); $row['wholesale_unit_cost'] = round($row['unit_price'], 2) + (PAYS_CUSTOMER_FEE == 'customer' ? round(ActiveCycle::wholesale_markup_next() * $row['unit_price'], 2) : 0) + round($row['customer_product_adjust_fee'] * $row['unit_price'], 2) + round($row['customer_subcat_adjust_fee'] * $row['unit_price'], 2) + round($row['customer_producer_adjust_fee'] * $row['unit_price'], 2); // These are per-item values baseed on the SHOW_ACTUAL_PRICE setting if (SHOW_ACTUAL_PRICE) { $row['display_unit_wholesale_price'] = $row['wholesale_unit_cost']; } else { $row['display_unit_wholesale_price'] = $row['unit_price']; } if (SHOW_ACTUAL_PRICE) { $row['display_unit_retail_price'] = $row['retail_unit_cost']; } else { $row['display_unit_retail_price'] = $row['unit_price']; } // These are line-item totals based on the SHOW_ACTUAL_PRICE setting if (SHOW_ACTUAL_PRICE) { $row['customer_display_cost'] = $row['customer_adjusted_cost'];
' . $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; } .admin_row {