Update app.py
Browse files37 unmodified lines3839404142434445464748495051525354555637 unmodified linesmaterial_type = st.selectbox("Material Type*",["32 ECT C-Flute", "44 ECT C-Flute", "200# C-Flute"])# Calculate buttonif st.button("Calculate Box Cost"):if not all([box_length, box_width, box_height, material_type]):st.error("Please fill in all required fields marked with *")else:# Calculate the box costblank_area, cost = calculate_box_cost(box_length, box_width, box_height, material_type)# Display results - only showing cost, not area as requestedst.subheader("Cost Calculation Results")st.metric("Estimated Cost", f"${cost:.4f}")# Information about factors affecting box cost (fixed to ensure it displays)st.subheader("Factors Affecting Box Cost")factors_text = """37 unmodified lines383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811937 unmodified linesmaterial_type = st.selectbox("Material Type*",["32 ECT C-Flute", "44 ECT C-Flute", "200# C-Flute"])# New fields - Minimum Order Quantity and Current Pricecol1, col2 = st.columns(2)with col1:moq = st.number_input("Minimum Order Quantity (optional)", min_value=0, value=0, step=100)with col2:current_price = st.number_input("Current Price per Box ($) (optional)", min_value=0.0, value=0.0, step=0.01, format="%.4f")# Order quantity inputorder_quantity = st.number_input("Order Quantity*", min_value=1, value=1000, step=100)# Calculate buttonif st.button("Calculate Box Cost"):if not all([box_length, box_width, box_height, material_type, order_quantity]):st.error("Please fill in all required fields marked with *")else:# Calculate the box costblank_area, cost = calculate_box_cost(box_length, box_width, box_height, material_type)# Display resultsst.subheader("Cost Calculation Results")# Calculate total costtotal_cost = cost * order_quantity# Display metricscol1, col2 = st.columns(2)with col1:st.metric("Estimated Cost per Box", f"${cost:.4f}")with col2:st.metric("Total Cost", f"${total_cost:.2f}")# MOQ validation (if provided)if moq > 0:st.subheader("Minimum Order Quantity")if order_quantity < moq:st.warning(f"⚠️ Your requested quantity ({order_quantity}) is below the minimum order quantity ({moq}). Please consider increasing your order quantity to meet minimum requirements.")else:st.success(f"✅ Your requested quantity ({order_quantity}) meets or exceeds the minimum order quantity ({moq}).")# Price comparison (if current price provided)if current_price > 0:st.subheader("Price Comparison Analysis")price_difference = ((current_price - cost) / current_price) * 100if cost < current_price:st.info(f"""Your current price (${current_price:.4f}) is approximately {abs(price_difference):.1f}% higher than our estimate.We can help analyze why there might be a difference:- Material sourcing options- Production efficiency improvements- Box design optimization- Bulk purchasing opportunitiesContact us for a detailed cost analysis of your current packaging solution.""")elif cost > current_price:st.success(f"""Your current price (${current_price:.4f}) is approximately {abs(price_difference):.1f}% lower than our estimate.You're getting a great price on your packaging! We'd be happy to:- Review your other SKUs to identify additional savings- Analyze alternative packaging solutions that could work for your product- Evaluate if there are sustainability improvements possible at similar price pointsContact us to review your other packaging needs.""")else:st.info(f"""Your current price matches our estimate exactly. This suggests your current pricing is well-aligned with market rates.We'd be happy to review your other packaging needs or discuss ways to improve sustainability without increasing costs.""")# Information about factors affecting box costst.subheader("Factors Affecting Box Cost")factors_text = """
app.py+67-4