#!/bin/bash #Heavy_Duty_stainless_steel_keychains # tarikh va zaman get_persian_date() { date +"%Y/%m/%d %H:%M:%S" } # format adad ba jodakonande hezargi format_number() { echo "$1" | awk '{printf "%\47.2f\n", $1}' } # zakhire natayej dar file save_to_file() { local filename="jakeleidi_calculations_$(date +%Y%m%d_%H%M%S).txt" echo "=== Natayej Mohasebe Jakeleidi ===" > "$filename" echo "Tarikh: $(get_persian_date)" >> "$filename" echo "$1" >> "$filename" echo "File dar $filename zakhire shod" } # mohasebe gheymat calculate_price() { clear echo "=== Mohasebe Gheymat Jadid ===" echo "" read -p "Name mahsol (ekhtiari): " product_name # mavad avvaliye echo "" echo "--- Mavad Avvaliye ---" read -p "Gheymat sim estil baraye har kilo (toman): " wire_price_per_kg read -p "Tedad shakhe haye shenavari ke az har kilo misazid: " branches_per_kg read -p "Hazine zib kari (polish) va dastmozd sakht (toman): " polish_labor_cost read -p "Hazine zip kip (toman) [pishfarz: 2000]: " zip_cost zip_cost=${zip_cost:-2000} read -p "Hazine dastmal microfiber (toman) [pishfarz: 12000]: " microfiber_cost microfiber_cost=${microfiber_cost:-12000} read -p "Hazine hard box (toman) [pishfarz: 50000]: " hardbox_cost hardbox_cost=${hardbox_cost:-50000} read -p "Hazine haye ezafe (karaye mashin, haml o naghl, ...) (toman): " extra_costs # forush echo "" echo "--- Forush ---" read -p "Hazine post pishtaz (toman): " post_cost read -p "Darsad komision site (%) [pishfarz: 7]: " commission_percent commission_percent=${commission_percent:-7} read -p "Darsad takhfif baraye maghaze daran (%) [pishfarz: 20]: " discount_wholesale_percent discount_wholesale_percent=${discount_wholesale_percent:-20} read -p "Darsad sud forush takhassosi (%): " profit_retail read -p "Darsad sud forush tomin (%): " profit_wholesale read -p "Darsad takhfif forush takhassosi (%): " discount_retail_percent # mohasebat wire_price_per_branch=$(echo "scale=2; $wire_price_per_kg / $branches_per_kg" | bc) total_material_cost=$(echo "scale=2; $wire_price_per_branch + $polish_labor_cost + $zip_cost + $microfiber_cost + $hardbox_cost + $extra_costs" | bc) total_cost=$(echo "scale=2; $total_material_cost" | bc) # gheymat tomin (be maghaze daran) price_wholesale_before_discount=$(echo "scale=2; $total_cost * (1 + $profit_wholesale / 100)" | bc) price_wholesale=$(echo "scale=2; $price_wholesale_before_discount * (1 - $discount_wholesale_percent / 100)" | bc) # gheymat takhassosi (be moshtari nahayi) price_before_post_and_commission=$(echo "scale=2; $total_cost * (1 + $profit_retail / 100)" | bc) price_before_discount=$(echo "scale=2; ($price_before_post_and_commission + $post_cost) / (1 - $commission_percent / 100)" | bc) final_retail_price=$(echo "scale=2; $price_before_discount * (1 - $discount_retail_percent / 100)" | bc) # jam bandi natayej local result=" Name mahsol: ${product_name:-na-moshakhas} Tarikh mohasebe: $(get_persian_date) --- Tafsilat Mavad Avvaliye --- Gheymat har kilo sim estil: $(format_number $wire_price_per_kg) toman Tedad shakhe az har kilo: $branches_per_kg Gheymat sim baraye har shakhe: $(format_number $wire_price_per_branch) toman Hazine polish va dastmozd sakht: $(format_number $polish_labor_cost) toman Hazine zip kip: $(format_number $zip_cost) toman Hazine dastmal microfiber: $(format_number $microfiber_cost) toman Hazine hard box: $(format_number $hardbox_cost) toman Hazine haye ezafe: $(format_number $extra_costs) toman --- Kol hazine mavad avvaliye: $(format_number $total_material_cost) toman --- Forush --- Hazine post pishtaz: $(format_number $post_cost) toman Darsad komision site: $commission_percent% Darsad takhfif maghaze daran: $discount_wholesale_percent% --- Gheymat haye forush --- 1. Forush tomin (be maghaze daran): • Gheymat paye: $(format_number $price_wholesale_before_discount) toman • Ba takhfif $discount_wholesale_percent%: $(format_number $price_wholesale) toman • Sud tomin: $(format_number $(echo "$price_wholesale - $total_cost" | bc)) toman • Darsad sud tomin: $(echo "scale=2; (($price_wholesale - $total_cost) / $total_cost) * 100" | bc)% 2. Forush takhassosi (be moshtari nahayi): • Gheymat ghabl az takhfif: $(format_number $price_before_discount) toman • Ba takhfif ${discount_retail_percent}%: $(format_number $final_retail_price) toman • Sud takhassosi: $(format_number $(echo "$final_retail_price - $total_cost" | bc)) toman • Darsad sud takhassosi: $(echo "scale=2; (($final_retail_price - $total_cost) / $total_cost) * 100" | bc)% --- Moqayese --- Tafavot gheymat tomin va takhassosi: $(format_number $(echo "$final_retail_price - $price_wholesale" | bc)) toman " echo "$result" # zakhire dar file echo "" read -p "Aya mikhahid natayej ra zakhire konid? (y/n): " save_choice if [[ "$save_choice" == "y" || "$save_choice" == "Y" ]]; then save_to_file "$result" fi # mohasebe baraye tedad echo "" read -p "Aya mikhahid baraye tedad moshakhasi mohasebe konid? (y/n): " quantity_choice if [[ "$quantity_choice" == "y" || "$quantity_choice" == "Y" ]]; then read -p "Tedad mored nazar: " quantity if [[ "$quantity" -gt 0 ]]; then wire_needed_kg=$(echo "scale=2; $quantity / $branches_per_kg" | bc) total_wire_cost=$(echo "scale=2; $wire_needed_kg * $wire_price_per_kg" | bc) total_material_cost_all=$(echo "scale=2; ($polish_labor_cost + $zip_cost + $microfiber_cost + $hardbox_cost + $extra_costs) * $quantity" | bc) total_investment=$(echo "scale=2; $total_wire_cost + $total_material_cost_all" | bc) total_wholesale_revenue=$(echo "$price_wholesale * $quantity" | bc) total_retail_revenue=$(echo "$final_retail_price * $quantity" | bc) echo " --- Natayej baraye $quantity adad ($wire_needed_kg kilo sim) --- Sarmaye mored niaz baraye sim: $(format_number $total_wire_cost) toman Sarmaye mored niaz baraye mavad digar: $(format_number $total_material_cost_all) toman Sarmaye kole mored niaz: $(format_number $total_investment) toman Dar sorat forush tomin: • Daramad kol: $(format_number $total_wholesale_revenue) toman • Sud kol: $(format_number $(echo "$total_wholesale_revenue - $total_investment" | bc)) toman Dar sorat forush takhassosi: • Daramad kol: $(format_number $total_retail_revenue) toman • Sud kol: $(format_number $(echo "$total_retail_revenue - $total_investment" | bc)) toman " fi fi } # namayesh tarikhche show_history() { clear echo "=== File haye zakhire shode ===" echo "" local files=$(ls -1t jakeleidi_calculations_*.txt 2>/dev/null | head -10) if [ -z "$files" ]; then echo "Hich file zakhire i yaft nashod." else echo "Akharin 10 file:" echo "----------------" local count=1 for file in $files; do echo "$count. $file" count=$((count + 1)) done echo "" read -p "Shomare file baraye moahede (0 baraye bargasht): " file_choice if [[ "$file_choice" -gt 0 ]]; then file_array=($files) if [[ "$file_choice" -le ${#file_array[@]} ]]; then clear cat "${file_array[$((file_choice-1))]}" echo "" read -p "Enter baraye edame..." fi fi fi } # guide darbareye mavad avvaliye show_materials_guide() { clear echo "=== Rahnamaye Mavad Avvaliye ===" echo "" echo "1. Sim estil (1-2 mm): 50,000 - 150,000 toman baraye har kilo" echo "2. Toghaye dekorativ: 10,000 - 50,000 toman" echo "3. Halghe zanjir: 5,000 - 20,000 toman" echo "4. Abzarkar (pliers, cutter): hissab kardan bar asase amortizasion" echo "5. Dastgah haye dast (rang, lacquer): 20,000 - 100,000 toman" echo "6. Zip kip: 1,500 - 2,500 toman" echo "7. Dastmal microfiber: 10,000 - 15,000 toman" echo "8. Hard box: 30,000 - 70,000 toman" echo "" echo "Pishnahad:" echo "- Baraye avalin bar, kamtar mavad bekharid" echo "- Gheymat haye bazara ra motalee konid" echo "- Az forushandegan mo'tabar kharid konid" echo "" read -p "Enter baraye edame..." } # mohasebe amortizasion abzar calculate_tool_amortization() { clear echo "=== Mohasebe Amortizasion Abzar ===" echo "" read -p "Gheymat kole abzar (toman): " tool_price read -p "Tedad mahsolat ke mitavanid ba in abzar besazid: " total_products read -p "Tedad mahsole ke mikhahid besazid: " planned_products if [[ "$total_products" -gt 0 && "$planned_products" -gt 0 ]]; then amortization_per_product=$(echo "scale=2; $tool_price / $total_products" | bc) total_amortization=$(echo "scale=2; $amortization_per_product * $planned_products" | bc) echo "" echo "Amortizasion baraye har mahsol: $(format_number $amortization_per_product) toman" echo "Amortizasion kole baraye $planned_products mahsol: $(format_number $total_amortization) toman" echo "" echo "In mablagh ra be 'Hazine haye ezafe' ezafe konid." else echo "Tedad haye vared shode na motabar hastand." fi read -p "Enter baraye edame..." } # menu asli main_menu() { while true; do clear echo "=== Abzar Herfei Mohasebe Gheymat Jakeleidi Dastsaz ===" echo "" echo "Tarikh: $(get_persian_date)" echo "" echo "1. Mohasebe gheymat jadid" echo "2. Moahede tarikhche mohasebat" echo "3. Rahnamaye mavad avvaliye" echo "4. Mohasebe amortizasion abzar" echo "5. Rahnamaye forush va marketing" echo "6. Kharoj" echo "" read -p "Lotfan gozine mored nazar ra entekhab konid (1-6): " choice case $choice in 1) calculate_price read -p "Enter baraye edame..." ;; 2) show_history ;; 3) show_materials_guide ;; 4) calculate_tool_amortization ;; 5) clear echo "=== Rahnamaye Forush va Marketing ===" echo "" echo "1. Gheymat gozari dar Instagram:" echo " - Gheymat takhassosi: 2-3 barabar tamam-shode" echo " - Gheymat tomin: 1.5-2 barabar tamam-shode" echo "" echo "2. Platform haye forush:" echo " - Instagram: komision nadarad" echo " - Digikala: 15-25% komision" echo " - Bamilon: 10-20% komision" echo " - Site haye digar: 7-15% komision" echo "" echo "3. Takhfif haye moaser:" echo " - Takhfif 10% baraye har 2 mahsol" echo " - Takhfif 15% baraye followers" echo " - Gift baraye kharid haye bishtar az 200,000 toman" echo "" echo "4. Packaging: 5,000 - 20,000 toman baraye har mahsol" echo "" read -p "Enter baraye edame..." ;; 6) echo "Kharoj az barname..." exit 0 ;; *) echo "Gozine namotabar!" sleep 1 ;; esac done } # shoroe barname clear echo "Dar hale bar gozari..." sleep 1 main_menu