Skip to content

Instantly share code, notes, and snippets.

@kirillrocks
Last active August 27, 2017 13:56
Show Gist options
  • Select an option

  • Save kirillrocks/6542cb97ea3bd60010aa8920440399ec to your computer and use it in GitHub Desktop.

Select an option

Save kirillrocks/6542cb97ea3bd60010aa8920440399ec to your computer and use it in GitHub Desktop.
<?php
/**
* Created by CODEJA.
* User: kirillrocks
* Date: 27-Aug-17
* Time: 15:12
*/
/** CONSTANTS NORMAL **/
$selected_width = 5; // taken from selection by the user
$selected_height = 10; // taken from selection by the user
$mat_selected_width = 1; // taken from selection by the user
$mat_selected_height = 1; // taken from selection by the user
$picture_cost = 1000; // original picture price
$paper_print_cost = 1.5; // get it from admin
$mat_cost_per_size = 0.5; // get it from admin
$frame_cost_for_height = 1; // get it from admin
$frame_cost_front_and_back = 2; // get it from admin
$clearing_fee = '3%'; // percent of total price
// 3 packages price
$package_price_1 = 1; // without frame and without mat
$package_price_2 = 2; // without frame, with mat
$package_price_3 = 3; // with frame
// 3 shipping price
$shipping_price_1 = 1; // without frame and without mat
$shipping_price_2 = 2; // without frame, with mat
$shipping_price_3 = 3; // with frame
// profits
$profit_1 = 1; // get it from admin
$profit_2 = 2; // get it from admin
$profit_3 = 3; // get it from admin
// Mathematical
$paper_cost = $selected_width * $selected_height * $paper_print_cost;
$mat_cost = $selected_width + ( $mat_selected_width * 2 ) * ( $selected_height + ( $mat_selected_width * 2 ) ) * $mat_cost_per_size;
$frame_cost = $selected_width + ( $mat_selected_width * 2 ) * ( $selected_height + ( $mat_selected_width * 2 ) ) * 2 * $frame_cost_for_height + $selected_width + ( $mat_selected_width * 2 ) * ( $selected_height + ( $mat_selected_width * 2 ) ) * $frame_cost_front_and_back;
$selected_package;
$selected_shipping;
// TOTALS
$total_price = ( $profit_1 * $picture_cost + $profit_2 * ( $paper_cost + $mat_cost + $frame_cost ) + $profit_3 * ( $selected_package + $selected_shipping ) ) * $clearing_fee;
$artist_revenue = ( $total_price - $paper_cost - $mat_cost - $frame_cost - $selected_package - $selected_shipping ) / 2;
/***********************/
/** CONSTANTS CANVAS **/
/***********************/
$selected_width = 5; // taken from selection by the user
$selected_height = 10; // taken from selection by the user
$picture_cost = 1000; // original picture price
$frame_cost_for_height = 1; // get it from admin
$canvas_print_cost = 1; // get it from admin
$profile_long_cost = 1; //get it from admin
$clearing_fee = '3%'; // percent of total price
// 3 packages price
$package_price_4 = 1; // without frame and without stretch
$package_price_5 = 5; // with stretch
// 3 shipping price
$shipping_price_4 = 4; // without frame and without stretch
$shipping_price_5 = 5; // with stretch
// profits
$profit_1 = 1; // get it from admin
$profit_2 = 2; // get it from admin
$profit_3 = 3; // get it from admin
// Mathematical
$canvas_cost = $selected_width * $selected_height * $canvas_print_cost;
$profile_cost = $selected_width * $selected_height * $profile_long_cost;
$frame_cost = ( $selected_width + $selected_height ) * 2 * $frame_cost_for_height;
$selected_package;
$selected_shipping;
// TOTALS
$total_price = ( $profit_1 * $picture_cost + $profit_2 * ( $canvas_cost + $profile_cost + $frame_cost ) + $profit_3 * ( $selected_package + $selected_shipping ) ) * $clearing_fee;
$artist_revenue = ( $total_price - $canvas_cost - $frame_cost - $selected_package - $selected_shipping ) / 2;
/***********************/
/** CONSTANTS ACRYLIC + MDF **/
/***********************/
$selected_width = 5; // taken from selection by the user
$selected_height = 10; // taken from selection by the user
$picture_cost = 1000; // original picture price
$print_price_on_acrylic = 1; // get it from admin
$print_price_on_mdf = 1; // get it from admin
$hanging_cost = 4; // get it from admin
$clearing_fee = '3%'; // percent of total price
// 3 packages price
$package_price_5 = 5; // with stretch
// 3 shipping price
$shipping_price_6 = 6; // size 1
$shipping_price_7 = 7; // size 2
$shipping_price_8 = 8; // size 3
// profits
$profit_1 = 1; // get it from admin
$profit_2 = 2; // get it from admin
$profit_3 = 3; // get it from admin
// Mathematical
if ( SELECTED_MDF ) {
$material_and_print_cost = $selected_width * $selected_height * $print_price_on_mdf;
} else if ( SELECTED_ACRYLIC ) {
$material_and_print_cost = $selected_width * $selected_height * $print_price_on_acrylic;
}
$selected_package;
$selected_shipping;
// TOTALS
$total_price = ( $profit_1 + $picture_cost + $profit_2 * ( $material_and_print_cost + $hanging_cost ) + $profit_3 * ( $selected_package + $selected_shipping ) ) * $clearing_fee;
$artist_revenue = ( $total_price - $material_and_print_cost - $hanging_cost - $selected_package - $selected_shipping ) / 2;
/***********************/
/** CONSTANTS MINI CANVAS/ACRYLIC BLOCK **/
/***********************/
$selected_width = 5; // taken from selection by the user
$selected_height = 10; // taken from selection by the user
$picture_cost = 1000; // original picture price
$print_price_on_small_acrylic = 1; // get it from admin
$print_price_on_big_acrylic = 2; // get it from admin
$print_price_on_mini_canvas = 2; // get it from admin
$clearing_fee = '3%'; // percent of total price
// 3 packages price
$package_price_5 = 5; // with stretch
// 3 shipping price
$shipping_price_9 = 9; // size 3
// profits
$profit_1 = 1; // get it from admin
$profit_2 = 2; // get it from admin
$profit_3 = 3; // get it from admin
// Mathematical
if ( SMALL_ACRYLIC ) {
$material_and_print_cost = $selected_width * $selected_height * $print_price_on_small_acrylic;
} else if ( BIG_ACRYLIC ) {
$material_and_print_cost = $selected_width * $selected_height * $print_price_on_big_acrylic;
} else if ( MINI_CANVAS ) {
$material_and_print_cost = $selected_width * $selected_height * $print_price_on_mini_canvas;
}
$selected_package;
$selected_shipping;
// TOTALS
$total_price = ( $profit_1 + $picture_cost + $profit_2 * $material_and_print_cost + $profit_3 * ( $selected_package + $selected_shipping ) ) * $clearing_fee;
$artist_revenue = ( $total_price - $material_and_print_cost - $selected_package - $selected_shipping ) / 2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment