* @author HamidReza Gharahzadeh * @author Sepehr Najafi */ class Ssbhesabix_Setting { /** * Hook in methods * @since 1.0.0 * @access static */ //========================================================================================================================== public static function init() { add_action( 'ssbhesabix_home_setting', array( __CLASS__, 'ssbhesabix_home_setting' ) ); add_action( 'ssbhesabix_catalog_setting', array( __CLASS__, 'ssbhesabix_catalog_setting' ) ); add_action( 'ssbhesabix_catalog_setting_save_field', array( __CLASS__, 'ssbhesabix_catalog_setting_save_field' ) ); add_action( 'ssbhesabix_customers_setting', array( __CLASS__, 'ssbhesabix_customers_setting' ) ); add_action( 'ssbhesabix_customers_setting_save_field', array( __CLASS__, 'ssbhesabix_customers_setting_save_field' ) ); add_action( 'ssbhesabix_invoice_setting', array( __CLASS__, 'ssbhesabix_invoice_setting' ) ); add_action( 'ssbhesabix_invoice_setting_save_field', array( __CLASS__, 'ssbhesabix_invoice_setting_save_field' ) ); add_action( 'ssbhesabix_payment_setting', array( __CLASS__, 'ssbhesabix_payment_setting' ) ); add_action( 'ssbhesabix_payment_setting_save_field', array( __CLASS__, 'ssbhesabix_payment_setting_save_field' ) ); add_action( 'ssbhesabix_api_setting', array( __CLASS__, 'ssbhesabix_api_setting' ) ); add_action( 'ssbhesabix_api_setting_save_field', array( __CLASS__, 'ssbhesabix_api_setting_save_field' ) ); add_action( 'ssbhesabix_export_setting', array( __CLASS__, 'ssbhesabix_export_setting' ) ); add_action( 'ssbhesabix_sync_setting', array( __CLASS__, 'ssbhesabix_sync_setting' ) ); add_action( 'ssbhesabix_log_setting', array( __CLASS__, 'ssbhesabix_log_setting' ) ); add_action( 'ssbhesabix_extra_setting', array( __CLASS__, 'ssbhesabix_extra_setting' ) ); add_action( 'ssbhesabix_extra_setting_save_field', array( __CLASS__, 'ssbhesabix_extra_setting_save_field' ) ); } //========================================================================================================================== public static function ssbhesabix_home_setting() { ?>

هشدارها
  • * افزونه حسابیکس از کد کالاها و مشتریان و از شماره فاکتور جهت شناسایی آنها استفاده می کند، بنابراین پس از ثبت کالاها و مشتریان در حسابیکس کد آنها را در حسابیکس تغییر ندهید، و همچنین پس از ثبت فاکتور، شماره فاکتور را در حسابیکس نباید تغییر دهید.
  • * با حذف افزونه از وردپرس، جدول ارتباط بین افزونه و حسابیکس نیز از دیتابیس وردپرس حذف می شود و کلیه ارتباطات از بین می رود.
نکات
  • * پیشنهاد می شود قبل از شروع کار با افزونه، حتما ویدیو خودآموز افزونه را مشاهده نمایید.

نصب افزونه
00:00
اتصال افزونه به حسابیکس
01:15
تنظیمات افزونه
04:06
تعریف محصول و لینک کردن محصول به حسابیکس
08:40
خروجی محصولات به حسابیکس
22:58
خروجی موجودی اول دوره محصولات به حسابیکس
24:22
خروجی مشتریان
24:55
ورود محصولات از حسابیکس به فروشگاه
25:25
همسان سازی قیمت و موجودی محصولات
26:32
همسان سازی سفارشات
27:25
بروزرسانی محصولات در حسابیکس بر اساس فروشگاه
29:18
سفارشات و ثبت فاکتور در حسابیکس
30:05
پشتیبان گیری از جدول افزونه در دیتابیس
35:20
لاگ رویدادها و خطاها
41:42
حذف محصولات
50:46
محصول پیش نویس
52:23
__('Enable or Disable Debug Mode', 'ssbhesabix'), 'id' => 'ssbhesabix_debug_mode_checkbox', 'default' => 'no', 'type' => 'checkbox', ); return $fields; } //============================================================================================== public static function ssbhesabix_extra_setting() { ?>
  • این صفحه برای تنظیمات پیشرفته افزونه می باشد

Plugin Version Server PHP Version Plugin PHP Version Tested Up To ' . $plugin_version . ' ' . $server_php_version . ' ' . $plugin_php_version . ' ' . ''; ?>
init( $ssbhesabf_setting_fields ); ?>
: 500

: 200

: 100

: 500

: 500

بروزرسانی ID آخرین تغییر

این گزینه تغییرات را به آخرین ID بروزرسانی می کند.


افزودن دستی محصول به حسابیکس

در فیلد کد ووکامرس، کد محصول بدون لینک را که می خواهید در حسابیکس ذخیره کنید، وارد نمایید.

در فیلد کد حسابیکس، کد حسابداری را وارد نمایید به طوری که محصولی با این کد حسابداری وجود نداشته باشد تا محصول ووکامرس انتخابی با این کد در حسابیکس اضافه شود.

در صورتی که محصول ساده است به جای کد متغیر عدد صفر را قرار دهید.

syncLastChangeID(); } if(isset($_POST['ssbhesabix_save_product_manually_to_hesabix'])) { $func = new Ssbhesabix_Admin_Functions(); if(empty($_POST['attribute_code'])) { $_POST['attribute_code'] = 0; } if (empty($_POST['woocommerce_code'])) { echo ""; } else { if(isset($_POST['hesabix_code']) && isset($_POST['woocommerce_code']) && isset($_POST['attribute_code'])) { $result = $func->SaveProductManuallyToHesabix($_POST['woocommerce_code'], $_POST['attribute_code'], $_POST['hesabix_code']); if($result) { echo ''; } else { echo ''; } } } } if(isset($_POST["ssbhesabix_integration"])) { if(isset($_POST['ssbhesabix_set_rpp_for_sync_products_into_hesabix'])) update_option('ssbhesabix_set_rpp_for_sync_products_into_hesabix', $_POST['ssbhesabix_set_rpp_for_sync_products_into_hesabix']); if(isset($_POST['ssbhesabix_set_rpp_for_sync_products_into_woocommerce'])) update_option('ssbhesabix_set_rpp_for_sync_products_into_woocommerce', $_POST['ssbhesabix_set_rpp_for_sync_products_into_woocommerce']); if(isset($_POST['ssbhesabix_set_rpp_for_import_products'])) update_option('ssbhesabix_set_rpp_for_import_products', $_POST['ssbhesabix_set_rpp_for_import_products']); if(isset($_POST['ssbhesabix_set_rpp_for_export_products'])) update_option('ssbhesabix_set_rpp_for_export_products', $_POST['ssbhesabix_set_rpp_for_export_products']); if(isset($_POST['ssbhesabix_set_rpp_for_export_opening_products'])) update_option('ssbhesabix_set_rpp_for_export_opening_products', $_POST['ssbhesabix_set_rpp_for_export_opening_products']); header('refresh:0'); } ?>

مشاهده آیتم های جدول ارتباط

getWpFaSearch($woocommerce_search_code, $woocommerce_attribute_search_code, $hesabix_search_code, $obj_type_search); ?>
ID نوع آیتم کد حسابیکس کد ووکامرس کد متغیر ووکامرس
id;?> objType;?> idHesabix;?> idWp;?> idWpAttribute;?>
save_fields( $ssbhesabf_setting_fields ); } //============================================================================================== public static function ssbhesabix_catalog_setting_fields() { $warehouses = Ssbhesabix_Setting::ssbhesabix_get_warehouses(); $fields[] = array( 'title' => __( 'Catalog Settings', 'ssbhesabix' ), 'type' => 'title', 'desc' => '', 'id' => 'catalog_options' ); $fields[] = array( 'title' => __( 'Update Price', 'ssbhesabix' ), 'desc' => __( 'Update Price after change in Hesabix', 'ssbhesabix' ), 'id' => 'ssbhesabix_item_update_price', 'default' => 'no', 'type' => 'checkbox' ); $fields[] = array( 'title' => __( 'Update Quantity', 'ssbhesabix' ), 'desc' => __( 'Update Quantity after change in Hesabix', 'ssbhesabix' ), 'id' => 'ssbhesabix_item_update_quantity', 'default' => 'no', 'type' => 'checkbox' ); $fields[] = array( 'title' => __( "Update product's quantity based on", 'ssbhesabix' ), 'id' => 'ssbhesabix_item_update_quantity_based_on', 'type' => 'select', 'options' => $warehouses, ); $fields[] = array( 'title' => "", 'desc' => __( 'Remove The Titles for Attributes When Saving Product To Hesabix', 'ssbhesabix' ), 'id' => 'ssbhesabix_remove_attributes_titles', 'default' => 'no', 'type' => 'checkbox' ); $fields[] = array( 'title' => "", 'desc' => __( 'Do not update purchase and sales titles in hesabix', 'ssbhesabix' ), 'id' => 'ssbhesabix_do_not_update_titles_in_hesabix', 'default' => 'no', 'type' => 'checkbox' ); $fields[] = array( 'title' => "", 'desc' => __( 'Do not submit product in Hesabix automatically by saving product in woocommerce', 'ssbhesabix' ), 'id' => 'ssbhesabix_do_not_submit_product_automatically', 'default' => 'no', 'type' => 'checkbox' ); $fields[] = array( 'title' => "", 'desc' => __( 'Do not update product price in Hesabix by editing product in woocommerce', 'ssbhesabix' ), 'id' => 'ssbhesabix_do_not_update_product_price_in_hesabix', 'default' => 'no', 'type' => 'checkbox' ); $fields[] = array( 'title' => "", 'desc' => __( 'Do not update product barcode in Hesabix by saving product in woocommerce', 'ssbhesabix' ), 'id' => 'ssbhesabix_do_not_update_product_barcode_in_hesabix', 'default' => 'no', 'type' => 'checkbox' ); $fields[] = array( 'title' => "", 'desc' => __( 'Do not update product category in Hesabix by saving product in woocommerce', 'ssbhesabix' ), 'id' => 'ssbhesabix_do_not_update_product_category_in_hesabix', 'default' => 'no', 'type' => 'checkbox' ); $fields[] = array( 'title' => "", 'desc' => __( 'Do not update product code in Hesabix by saving product in woocommerce', 'ssbhesabix' ), 'id' => 'ssbhesabix_do_not_update_product_product_code_in_hesabix', 'default' => 'no', 'type' => 'checkbox' ); $fields[] = array( 'title' => "", 'desc' => __( 'Show Hesabix ID in Products Page', 'ssbhesabix' ), 'id' => 'ssbhesabix_show_product_code_in_products_page', 'default' => 'no', 'type' => 'checkbox' ); $fields[] = array( 'title' => "", 'desc' => __( 'Show Hesabix Code in Woocommerce Excel Export', 'ssbhesabix' ), 'id' => 'ssbhesabix_show_hesabix_code_in_excel_export', 'default' => 'no', 'type' => 'checkbox' ); $fields[] = array( 'title' => "", 'desc' => __( 'Set Special Sale as Discount in invoice', 'ssbhesabix' ), 'id' => 'ssbhesabix_set_special_sale_as_discount', 'default' => 'no', 'type' => 'checkbox' ); $options_to_update_sale_price = array(); $options_to_update_sale_price[0] = __( "The Sale price does not change", 'ssbhesabix' ); $options_to_update_sale_price[1] = __( "The Sale price gets removed", 'ssbhesabix' ); $options_to_update_sale_price[2] = __( "The sale price get changes in proportion to the regular price", 'ssbhesabix' ); $fields[] = array( 'title' => __( "Update sale price", 'ssbhesabix' ), 'id' => 'ssbhesabix_item_update_sale_price', 'type' => 'select', 'options' => $options_to_update_sale_price, ); $fields[] = array( 'type' => 'sectionend', 'id' => 'catalog_options' ); return $fields; } //==================================================================================================== public static function ssbhesabix_catalog_setting() { $ssbhesabf_setting_fields = self::ssbhesabix_catalog_setting_fields(); $Html_output = new Ssbhesabix_Html_output(); ?>
init( $ssbhesabf_setting_fields ); ?>

save_fields( $ssbhesabf_setting_fields ); } //============================================================================================= public static function ssbhesabix_customers_setting_fields() { $fields[] = array( 'title' => __( 'Customers Settings', 'ssbhesabix' ), 'type' => 'title', 'desc' => '', 'id' => 'customer_options' ); $fields[] = array( 'title' => __( 'Update Customer Address', 'ssbhesabix' ), 'desc' => __( 'Choose when update Customer address in Hesabix.', 'ssbhesabix' ), 'id' => 'ssbhesabix_contact_address_status', 'type' => 'select', 'options' => array( '1' => __( 'Use first customer address', 'ssbhesabix' ), '2' => __( 'update address with Invoice address', 'ssbhesabix' ), '3' => __( 'update address with Delivery address', 'ssbhesabix' ) ), ); $fields[] = array( 'title' => __( 'Customer\'s Group', 'ssbhesabix' ), 'desc' => __( 'Enter a Customer\'s Group in Hesabix', 'ssbhesabix' ), 'id' => 'ssbhesabix_contact_node_family', 'type' => 'text', 'default' => 'مشتریان فروشگاه آنلاین' ); $fields[] = array( 'title' => __( 'Save Customer\'s group', 'ssbhesabix' ), 'desc' => __( 'Automatically save Customer\'s group in hesabix', 'ssbhesabix' ), 'id' => 'ssbhesabix_contact_automatic_save_node_family', 'default' => 'yes', 'type' => 'checkbox' ); $fields[] = array( 'title' => __( 'Customer\'s detail auto save and update', 'ssbhesabix' ), 'desc' => __( 'Save and update Customer\'s detail automatically in hesabix', 'ssbhesabix' ), 'id' => 'ssbhesabix_contact_automatically_save_in_hesabix', 'type' => 'checkbox', 'default' => 'yes' ); $fields[] = array( 'type' => 'sectionend', 'id' => 'customer_options' ); return $fields; } //============================================================================================= public static function ssbhesabix_customers_setting() { $ssbhesabf_setting_fields = self::ssbhesabix_customers_setting_fields(); $add_fields = get_option( 'ssbhesabix_contact_add_additional_checkout_fields_hesabix', 1 ); $nationalCodeCheck = get_option( 'ssbhesabix_contact_NationalCode_checkbox_hesabix' ) == 'yes'; $economicCodeCheck = get_option( 'ssbhesabix_contact_EconomicCode_checkbox_hesabix' ) == 'yes'; $registrationNumberCheck = get_option( 'ssbhesabix_contact_RegistrationNumber_checkbox_hesabix') == 'yes'; $websiteCheck = get_option( 'ssbhesabix_contact_Website_checkbox_hesabix') == 'yes'; $nationalCodeRequired = get_option( 'ssbhesabix_contact_NationalCode_isRequired_hesabix' ) == 'yes'; $economicCodeRequired = get_option( 'ssbhesabix_contact_EconomicCode_isRequired_hesabix' ) == 'yes'; $registrationNumberRequired = get_option( 'ssbhesabix_contact_RegistrationNumber_isRequired_hesabix') == 'yes'; $websiteRequired = get_option( 'ssbhesabix_contact_Website_isRequired_hesabix') == 'yes'; $nationalCodeMetaName = get_option( 'ssbhesabix_contact_NationalCode_text_hesabix', null ) ; $economicCodeMetaName = get_option( 'ssbhesabix_contact_EconomicCode_text_hesabix', null ) ; $registrationNumberMetaName = get_option( 'ssbhesabix_contact_RegistrationNumber_text_hesabix', null ); $websiteMetaName = get_option( 'ssbhesabix_contact_Website_text_hesabix', null ) ; $Html_output = new Ssbhesabix_Html_output(); ?>
init( $ssbhesabf_setting_fields ); ?>
>
>
class="form-control" value="yes"> class="form-control" value="yes">
class="form-control" value="yes"> class="form-control" value="yes">
class="form-control" value="yes"> class="form-control" value="yes">
class="form-control" value="yes"> class="form-control" value="yes">

save_fields( $ssbhesabf_setting_fields ); // .... } //============================================================================================= public static function ssbhesabix_invoice_setting_fields() { $projects = Ssbhesabix_Setting::ssbhesabix_get_projects(); $salesmen = Ssbhesabix_Setting::ssbhesabix_get_salesmen(); $fields[] = array( 'title' => __( 'Invoice Settings', 'ssbhesabix' ), 'type' => 'title', 'desc' => '', 'id' => 'invoice_options' ); $fields[] = array( 'title' => __( 'Add invoice in which status', 'ssbhesabix' ), 'id' => 'ssbhesabix_invoice_status', 'type' => 'multiselect', 'options' => array( 'pending' => __( 'Pending payment', 'ssbhesabix' ), 'processing' => __( 'Processing', 'ssbhesabix' ), 'on-hold' => __( 'On hold', 'ssbhesabix' ), 'completed' => __( 'Completed', 'ssbhesabix' ), 'cancelled' => __( 'Cancelled', 'ssbhesabix' ), 'refunded' => __( 'Refunded', 'ssbhesabix' ), 'failed' => __( 'Failed', 'ssbhesabix' ), 'checkout-draft' => __( 'Draft', 'ssbhesabix' ), ), ); $fields[] = array( 'title' => __( 'Return sale invoice status', 'ssbhesabix' ), 'id' => 'ssbhesabix_invoice_return_status', 'type' => 'multiselect', 'options' => array( 'pending' => __( 'Pending payment', 'ssbhesabix' ), 'processing' => __( 'Processing', 'ssbhesabix' ), 'on-hold' => __( 'On hold', 'ssbhesabix' ), 'completed' => __( 'Completed', 'ssbhesabix' ), 'cancelled' => __( 'Cancelled', 'ssbhesabix' ), 'refunded' => __( 'Refunded', 'ssbhesabix' ), 'failed' => __( 'Failed', 'ssbhesabix' ), 'checkout-draft' => __( 'Draft', 'ssbhesabix' ), ), ); $fields[] = array( 'title' => __( "Invoice's Project", 'ssbhesabix' ), 'id' => 'ssbhesabix_invoice_project', 'type' => 'select', 'options' => $projects, ); $fields[] = array( 'title' => __( "Invoice's Salesman", 'ssbhesabix' ), 'id' => 'ssbhesabix_invoice_salesman', 'type' => 'select', 'options' => $salesmen, ); $fields[] = array( 'title' => __( "Invoice Salesman Percentage", 'ssbhesabix' ), 'id' => 'ssbhesabix_invoice_salesman_percentage', 'type' => 'text', 'placeholder' => __("Invoice Salesman Percentage", 'ssbhesabix'), ); $fields[] = array( 'title' => '', 'desc' => __('Save invoice in draft mode in Hesabix', 'ssbhesabix'), 'id' => 'ssbhesabix_invoice_draft_save_in_hesabix', 'type' => 'checkbox', 'default' => 'no' ); $fields[] = array( 'title' => __('Save Freight', 'ssbhesabix'), 'id' => 'ssbhesabix_invoice_freight', 'type' => 'radio', 'options' => [ 0 => __("Save as Freight", 'ssbhesabix'), 1 => __("Save as a Service", 'ssbhesabix') ], ); $fields[] = array( 'title' => __('Service Code For Freight', 'ssbhesabix'), 'id' => 'ssbhesabix_invoice_freight_code', 'type' => 'text', 'placeholder' => __('Enter Freight Code', 'ssbhesabix'), ); if(is_plugin_active( 'dokan-lite/dokan.php' )){ $fields[] = array( 'title' => __( "Submit invoice base on Dokan orders", 'ssbhesabix' ), 'id' => 'ssbhesabix_invoice_dokan', 'type' => 'radio', 'options' => [0 => __( "Inactive", 'ssbhesabix' ), 1 => __( "Submit parent order", 'ssbhesabix' ), 2 => __( "Submit children orders", 'ssbhesabix' )], 'default' => 0 ); } $fields[] = array('type' => 'sectionend', 'id' => 'invoice_options'); return $fields; } //============================================================================================= public static function ssbhesabix_invoice_setting() { $ssbhesabf_setting_fields = self::ssbhesabix_invoice_setting_fields(); $Html_output = new Ssbhesabix_Html_output(); ?>
توجه
در اینجا تعیین کنید که فاکتور سفارش در چه مرحله ای در حسابیکس ثبت شود. و چه زمان برای یک سفارش فاکتور برگشت از فروش ثبت شود.
در صورت انتخاب ذخیره هزینه حمل و نقل به عنوان یک خدمت، ابتدا باید یک خدمت در حسابیکس تعریف کنید و کد مربوط به آن را در فیلد کد خدمت حمل و نقل وارد و ذخیره نمایید.
فیلد "ذخیره هزینه به عنوان خدمت" برای سامانه مودیان مالیاتی می باشد.
توجه کنید که مقدار این فیلد به درستی وارد شده باشد تا در ثبت فاکتور مشکلی ایجاد نشود.
init( $ssbhesabf_setting_fields ); ?>

alert("کد خدمت حمل و نقل تعریف نشده است")'; } ?>
save_fields( $ssbhesabf_setting_fields ); } //============================================================================================= public static function ssbhesabix_payment_setting_fields() { $banks = Ssbhesabix_Setting::ssbhesabix_get_banks(); $cashes = Ssbhesabix_Setting::ssbhesabix_get_cashes(); $payInputValue = array_merge($banks,$cashes); $payment_gateways = new WC_Payment_Gateways; $available_payment_gateways = $payment_gateways->get_available_payment_gateways(); $fields[] = array( 'title' => __( 'Payment methods Settings', 'ssbhesabix' ), 'type' => 'title', 'desc' => '', 'id' => 'payment_options' ); $fields[] = array( 'title' => __( 'Add payment in which status', 'ssbhesabix' ), 'id' => 'ssbhesabix_payment_status', 'type' => 'multiselect', 'options' => array( 'pending' => __( 'Pending payment', 'ssbhesabix' ), 'processing' => __( 'Processing', 'ssbhesabix' ), 'on-hold' => __( 'On hold', 'ssbhesabix' ), 'completed' => __( 'Completed', 'ssbhesabix' ), 'cancelled' => __( 'Cancelled', 'ssbhesabix' ), 'refunded' => __( 'Refunded', 'ssbhesabix' ), 'failed' => __( 'Failed', 'ssbhesabix' ), 'checkout-draft' => __( 'Draft', 'ssbhesabix' ), ), ); foreach ( $available_payment_gateways as $gateway ) { $fields[] = array( 'title' => $gateway->title, 'id' => 'ssbhesabix_payment_method_' . $gateway->id, 'type' => 'select', 'options' => $payInputValue ); } foreach ( $available_payment_gateways as $gateway ) { $fields[] = array( 'title' => 'درصد کارمزد تراکنش برای ' . $gateway->title, 'id' => 'ssbhesabix_payment_transaction_fee_' . $gateway->id, 'class' => 'payment-transaction-fee', 'type' => 'text', 'placeholder' => 'وارد نمایید', 'default' => '0', ); } $plugins = get_plugins(); foreach ($plugins as $plugin_file => $plugin_info) { if ($plugin_file === 'snapppay-woocommerce-gateway /index.php') { if(is_plugin_active('snapppay-woocommerce-gateway /index.php')) { $fields[] = array( 'title' => 'پرداخت اسنپ پی', 'id' => 'ssbhesabix_payment_method_snapppay', 'type' => 'select', 'options' => $payInputValue ); $fields[] = array( 'title' => 'درصد کارمزد تراکنش برای پرداخت اسنپ پی', 'id' => 'ssbhesabix_payment_transaction_fee_snapppay', 'type' => 'text', 'placeholder' => 'وارد نمایید', 'default' => '0', ); } } } $fields[] = array( 'title' => __('Default Payment Gateway By Using this Option, all Invoices Will Have this Payment Gateway as Their Payment Gateway', 'ssbhesabix'), 'id' => 'ssbhesabix_payment_option', 'type' => 'radio', 'options' => [ 'yes' => __("Save Default Bank as the Payment Gateway", "ssbhesabix"), 'no' => __("Save Other Payment Methods as the Payment Gateway", "ssbhesabix"), ], 'default' => 'no' ); $fields[] = array( 'title' => __( "Default Invoice Transaction Fee Percentage", 'ssbhesabix' ), 'id' => 'ssbhesabix_invoice_transaction_fee', 'type' => 'text', 'class' => 'payment-transaction-fee', 'placeholder' => __("Default Invoice Transaction Fee Percentage", 'ssbhesabix'), 'default' => '0' ); $fields[] = array( 'title' => __( "Submit Cash in Transit", 'ssbhesabix' ), 'id' => 'ssbhesabix_cash_in_transit', 'desc' => __( "Submit Invoice Receipt Cash in Transit", 'ssbhesabix' ), 'type' => 'checkbox', 'default' => 'no' ); $fields[] = array( 'title' => __('Default Bank Code', 'ssbhesabix'), 'id' => 'ssbhesabix_default_payment_method_code', 'type' => 'text', 'placeholder' => __('Enter Bank Code', 'ssbhesabix') ); $fields[] = array( 'title' => __('Default Bank Name', 'ssbhesabix'), 'id' => 'ssbhesabix_default_payment_method_name', 'type' => 'text', 'placeholder' => __('Enter Bank Name', 'ssbhesabix') ); $fields[] = array( 'type' => 'sectionend', 'id' => 'payment_options' ); return $fields; } //============================================================================================= public static function ssbhesabix_payment_setting() { $ssbhesabf_setting_fields = self::ssbhesabix_payment_setting_fields(); $Html_output = new Ssbhesabix_Html_output(); ?>
توجه
در اینجا تعیین کنید که رسید دریافت وجه فاکتور در چه وضعیتی ثبت شود و در هر روش پرداخت، رسید در چه بانکی و یا صندوقی ثبت شود.
بانک پیش فرض، جهت کاربرانی می باشد که به هر دلیلی روش های پرداخت وکامرس در اینجا نمایش داده نمی شود. در این صورت با انتخاب بانک و ثبت کد آن، تمامی دریافت ها در آن بانک ثبت خواهد شد
درصد کارمزد تراکنش برای هر روش پرداخت می تواند تعریف شود(بین 1 تا 100).
درصد کارمزد تراکنش پیش فرض زمانی اعمال می شود که درصد یک روش پرداخت یا تعریف نشده باشد و یا صفر باشد.
init( $ssbhesabf_setting_fields ); ?>

alert("کد بانک پیش فرض تعریف نشده است")'; } if(get_option("ssbhesabix_cash_in_transit") == "yes" || get_option("ssbhesabix_cash_in_transit") == "1") { $func = new Ssbhesabix_Admin_Functions(); $cashInTransitFullPath = $func->getCashInTransitFullPath(); if(!$cashInTransitFullPath) { HesabixLogService::writeLogStr("Cash in Transit is not Defined in Hesabix ---- وجوه در راه در حسابیکس یافت نشد"); echo ' '; } } ?>
save_fields( $ssbhesabf_setting_fields ); } //============================================================================================= public static function ssbhesabix_api_setting_fields() { $fields[] = array( 'title' => __( 'API Settings', 'ssbhesabix' ), 'type' => 'title', 'desc' => '', 'id' => 'api_options' ); $fields[] = array( 'title' => __( 'API Key', 'ssbhesabix' ), 'desc' => __( 'Find API key in Setting->Financial Settings->API Menu', 'ssbhesabix' ), 'id' => 'ssbhesabix_account_api', 'type' => 'text', ); $fields[] = array( 'title' => __( 'API Address', 'ssbhesabix' ), 'id' => 'ssbhesabix_api_address', 'type' => 'select', 'options' => array( "0" => "hesabix.ir", "1" => "next.hesabix.ir" ) ); $fields[] = array( 'type' => 'sectionend', 'id' => 'api_options' ); return $fields; } //============================================================================================= public static function ssbhesabix_api_setting() { $businessInfo = self::getSubscriptionInfo(); $isBusinessInfo = false; if ( $businessInfo["expireDate"] != '' && $businessInfo["expireDate"] != null ) { $isBusinessInfo = true; $expireDate = strtotime( $businessInfo["expireDate"] ); $expireDateStr = date( "Y/m/d", $expireDate ); } $ssbhesabf_setting_fields = self::ssbhesabix_api_setting_fields(); $Html_output = new Ssbhesabix_Html_output(); ?>
توجه
  • برای اتصال به API حسابیکس و فعال شدن این افزونه باید در اینجا کلید API و توکن ورود به کسب و کار خود را وارد کنید.
  • اگر برای اتصال به API حسابیکس از توکن ورود استفاده کنید نیازی به وارد کردن ایمیل و رمز عبور نیست.
  • برای پیدا کردن توکن ورود و کلید API، در حسابیکس به قسمت تنظیمات، تنظیمات API مراجعه کنید.
  • اگر می خواهید کسب و کار دیگری را به افزونه متصل کنید، ابتدا باید یک بار افزونه را حذف و مجدد نصب کنید تا جدول ارتباطات کسب و کار قبلی با افزونه حذف گردد.
اطلاعات کسب و کار
نام کسب و کار:
طرح:
اعتبار سند:
تاریخ انقضا:
هشدار
برای اتصال یک کسب و کار دیگر به افزونه، ابتدا باید یک بار افزونه را حذف و مجدد نصب کنید تا جدول ارتباطات افزونه با کسب و کار قبل حذف گردد.
init( $ssbhesabf_setting_fields ); ?>

save_fields( $ssbhesabf_setting_fields ); Ssbhesabix_Setting::ssbhesabix_set_webhook(); } //============================================================================================= public static function ssbhesabix_export_setting() { // Export - Bulk product export offers $productExportResult = ( isset( $_GET['productExportResult'] ) ) ? wc_clean( $_GET['productExportResult'] ) : null; $productImportResult = ( isset( $_GET['productImportResult'] ) ) ? wc_clean( $_GET['productImportResult'] ) : null; $error = ( isset( $_GET['error'] ) ) ? wc_clean( $_GET['error'] ) : null; if ( ! is_null( $productExportResult ) && $productExportResult === 'true' ) { $processed = ( isset( $_GET['processed'] ) ) ? wc_clean( $_GET['processed'] ) : null; if ( $processed == 0 ) { echo '
'; echo '

' . __( 'No products were exported, All products were exported or there are no product', 'ssbhesabix' ); echo '

'; } else { echo '
'; echo '

' . sprintf( __( 'Export products completed. %s products added/updated.', 'ssbhesabix' ), $processed ); echo '

'; } } elseif ( $productExportResult === 'false' ) { if ( ! is_null( $error ) && $error === '-1' ) { echo '
'; echo '

' . __( 'Export products fail. Hesabix has already contained products.', 'ssbhesabix' ); echo '

'; } else { echo '
'; echo '

' . __( 'Export products fail. Please check the log file.', 'ssbhesabix' ); echo '

'; } } if ( ! is_null( $productImportResult ) && $productImportResult === 'true' ) { $processed = ( isset( $_GET['processed'] ) ) ? wc_clean( $_GET['processed'] ) : null; if ( $processed == 0 ) { echo '
'; echo '

' . __( 'No products were imported, All products were imported or there are no product', 'ssbhesabix' ); echo '

'; } else { echo '
'; echo '

' . sprintf( __( 'Import products completed. %s products added/updated.', 'ssbhesabix' ), $processed ); echo '

'; } } elseif ( $productImportResult === 'false' ) { echo '
'; echo '

' . __( 'Import products fail. Please check the log file.', 'ssbhesabix' ); echo '

'; } // Export - Product opening quantity export offers $productOpeningQuantityExportResult = ( isset( $_GET['productOpeningQuantityExportResult'] ) ) ? wc_clean( $_GET['productOpeningQuantityExportResult'] ) : null; if ( ! is_null( $productOpeningQuantityExportResult ) && $productOpeningQuantityExportResult === 'true' ) { echo '
'; echo '

' . __( 'Export product opening quantity completed.', 'ssbhesabix' ); echo '

'; } elseif ( ! is_null( $productOpeningQuantityExportResult ) && $productOpeningQuantityExportResult === 'false' ) { $shareholderError = ( isset( $_GET['shareholderError'] ) ) ? wc_clean( $_GET['shareholderError'] ) : null; $noProduct = ( isset( $_GET['noProduct'] ) ) ? wc_clean( $_GET['noProduct'] ) : null; if ( $shareholderError == 'true' ) { echo '
'; echo '

' . __( 'Export product opening quantity fail. No Shareholder exists, Please define Shareholder in Hesabix', 'ssbhesabix' ); echo '

'; } elseif ( $noProduct == 'true' ) { echo '
'; echo '

' . __( 'No product available for Export product opening quantity.', 'ssbhesabix' ); echo '

'; } else { echo '
'; echo '

' . __( 'Export product opening quantity fail. Please check the log file.', 'ssbhesabix' ); echo '

'; } } // Export - Bulk customer export offers $customerExportResult = ( isset( $_GET['customerExportResult'] ) ) ? wc_clean( $_GET['customerExportResult'] ) : null; if ( ! is_null( $customerExportResult ) && $customerExportResult === 'true' ) { $processed = ( isset( $_GET['processed'] ) ) ? wc_clean( $_GET['processed'] ) : null; if ( $processed == 0 ) { echo '
'; echo '

' . __( 'No customers were exported, All customers were exported or there are no customer', 'ssbhesabix' ); echo '

'; } else { echo '
'; echo '

' . sprintf( __( 'Export customers completed. %s customers added.', 'ssbhesabix' ), $processed ); echo '

'; } } elseif ( ! is_null( $customerExportResult ) && $customerExportResult === 'false' ) { if ( ! is_null( $error ) && $error === '-1' ) { echo '
'; echo '

' . __( 'Export customers fail. Hesabix has already contained customers.', 'ssbhesabix' ); echo '

'; } else { echo '
'; echo '

' . __( 'Export customers fail. Please check the log file.', 'ssbhesabix' ); echo '

'; } } ?>


  • با انجام این عملیات محصولات لینک نشده از فروشگاه وارد حسابیکس می شوند.
  • اگر محصولات از قبل هم در فروشگاه تعریف شده اند و هم در حسابیکس و به هم لینک نشده اند باید از گزینه همسان سازی دستی محصولات استفاده کنید.
  • با انجام این عملیات موجودی محصولات وارد حسابیکس نمی شود و برای وارد کردن موجودی محصولات فروشگاه در حسابیکس، باید از گزینه استخراج موجودی اول دوره استفاده کنید.

  • با انجام این عملیات موجودی کنونی محصولات در فروشگاه بعنوان موجودی اول دوره محصولات در حسابیکس ثبت می شوند.
  • بطور کلی فقط یک بار باید از این گزینه استفاده کنید، که این کار باید پس از خروج محصولات به حسابیکس و یا پس از همسان سازی دستی تمام محصولات انجام شود.

  • با انجام این عملیات مشتریان لینک نشده از فروشگاه وارد حسابیکس می شوند.
  • اگر یک مشتری بیش از یک بار وارد حسابیکس شده است می توانید از گزینه ادغام تراکنش ها در حسابیکس استفاده کنید.

  • با انجام این عملیات محصولات لینک نشده از حسابیکس وارد فروشگاه می شوند.
  • اگر محصولات از قبل هم در فروشگاه تعریف شده اند و هم در حسابیکس و به هم لینک نشده اند باید از گزینه همسان سازی دستی محصولات استفاده کنید.
  • محصولات در وضعیت خصوصی وارد فروشگاه می شوند و سپس هر زمان مایل بودید می توانید وضعیت را به منتشر شده تغییر دهید.
  • تمامی محصولات بعنوان محصول ساده (و نه متغیر) وارد فروشگاه می شوند.
'; echo '

' . __( 'Sync completed, All hesabix changes synced successfully.', 'ssbhesabix' ); echo ''; } // Sync - Bulk product sync offers $productSyncResult = ( isset( $_GET['productSyncResult'] ) ) ? wc_clean( $_GET['productSyncResult'] ) : null; if ( ! is_null( $productSyncResult ) && $productSyncResult == 'true' ) { echo '

'; echo '

' . __( 'Sync completed, All products price/quantity synced successfully.', 'ssbhesabix' ); echo '

'; } elseif ( ! is_null( $productSyncResult ) && ! $productSyncResult == 'false' ) { echo '
'; echo '

' . __( 'Sync products fail. Please check the log file.', 'ssbhesabix' ); echo '

'; } // Sync - Bulk invoice sync offers $orderSyncResult = ( isset( $_GET['orderSyncResult'] ) ) ? wc_clean( $_GET['orderSyncResult'] ) : null; if ( ! is_null( $orderSyncResult ) && $orderSyncResult === 'true' ) { $processed = ( isset( $_GET['processed'] ) ) ? wc_clean( $_GET['processed'] ) : null; echo '
'; echo '

' . sprintf( __( 'Order sync completed. %s order added.', 'ssbhesabix' ), $processed ); echo '

'; } elseif ( ! is_null( $orderSyncResult ) && $orderSyncResult === 'false' ) { $fiscal = ( isset( $_GET['fiscal'] ) ) ? wc_clean( $_GET['fiscal'] ) : false; if ( $fiscal === 'true' ) { echo '
'; echo '

' . __( 'The date entered is not within the fiscal year.', 'ssbhesabix' ); echo '

'; } else { echo '
'; echo '

' . __( 'Cannot sync orders. Please enter valid Date format.', 'ssbhesabix' ); echo '

'; } } // Sync - Bulk product update $productUpdateResult = ( isset( $_GET['$productUpdateResult'] ) ) ? wc_clean( $_GET['$productUpdateResult'] ) : null; if ( ! is_null( $productUpdateResult ) && $productUpdateResult == 'true' ) { echo '
'; echo '

' . __( 'Update completed successfully.', 'ssbhesabix' ); echo '

'; } elseif ( ! is_null( $productUpdateResult ) && ! $productUpdateResult == 'false' ) { echo '
'; echo '

' . __( 'Update failed. Please check the log file.', 'ssbhesabix' ); echo '

'; } // Sync - Bulk product with filter update in Hesabix $productUpdateWithFilterResult = ( isset( $_GET['$productUpdateWithFilterResult'] ) ) ? wc_clean( $_GET['$productUpdateWithFilterResult'] ) : null; if ( ! is_null( $productUpdateWithFilterResult ) && $productUpdateWithFilterResult == 'true' ) { echo '
'; echo '

' . __( 'Update completed successfully.', 'ssbhesabix' ); echo '

'; } elseif ( ! is_null( $productUpdateWithFilterResult ) && ! $productUpdateWithFilterResult == 'false' ) { echo '
'; echo '

' . __( 'Update failed. Please check the log file.', 'ssbhesabix' ); echo '

'; } ?>

' . $storeProductsCount . '' ?>

' . $hesabixProductsCount . '' ?>

' . $linkedProductsCount . '' ?>


  • با انجام این عملیات کالاها، مشتریان و سفارشاتی که تا کنون در حسابیکس ثبت نشده اند در حسابیکس ثبت می شوند.
  • توجه کنید که بصورت نرمال با فعالسازی افزونه و تکمیل تنظیمات API این همسان سازی بصورت خودکار انجام می شود و این گزینه صرفاْ برای مواقعی است که به دلایل فنی مثل قطع اتصال فروشگاه با حسابیکس و یا خطا و باگ این همسان سازی صورت نگرفته است.

  • با انجام این عملیات موجودی و قیمت محصولات در فروشگاه، بر اساس قیمت و موجودی آنها در حسابیکس تنظیم می شود.
  • این عملیات بر اساس تنظیمات صورت گرفته در تب محصولات انجام می شود.
تا

  • با انجام این عملیات سفارشات فروشگاه که در حسابیکس ثبت نشده اند از تاریخ انتخاب شده بررسی و در حسابیکس ثبت می شوند.
  • توجه کنید که بصورت نرمال با فعالسازی افزونه و تکمیل تنظیمات API این همسان سازی بصورت خودکار انجام می شود و این گزینه صرفاْ برای مواقعی است که به دلایل فنی مثل قطع اتصال فروشگاه با حسابیکس و یا خطا و باگ این همسان سازی صورت نگرفته است.

  • با انجام این عملیات ویژگی محصولات مثل نام و قیمت در حسابیکس، بر اساس فروشگاه بروزرسانی می شود.
  • در این عملیات موجودی کالا در حسابیکس تغییری نمی کند و بروز رسانی نمی شود.




  • با انجام این عملیات ویژگی محصولات مثل نام و قیمت در حسابیکس، بر اساس فروشگاه در بازه ID مشخص شده بروزرسانی می شود.
  • در این عملیات موجودی کالا در حسابیکس تغییری نمی کند و بروز رسانی نمی شود.
  • بازه ID نباید بیشتر از 200 عدد باشد.
$storeProductsCount, "hesabixProductsCount" => $hesabixProductsCount, "linkedProductsCount" => $linkedProductsCount ); } //============================================================================================= public static function getProductCountsInHesabix() { $hesabix = new Ssbhesabix_Api(); $filters = array( array( "Property" => "khadamat", "Operator" => "=", "Value" => 0 ) ); $response = $hesabix->itemGetItems( array('Filters' => $filters ) ); if ( $response->Success ) { return $response->data->FilteredCount; } else { return 0; } } //============================================================================================= // public static function getLinkedProductsCount() { // global $wpdb; // // return $wpdb->get_var( "SELECT COUNT(*) FROM `" . $wpdb->prefix . "ssbhesabix` WHERE `obj_type` = 'product'" ); // } public static function getLinkedProductsCount() { global $wpdb; return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}ssbhesabix WHERE obj_type = 'product'" ) ); } //============================================================================================= // public static function getProductCountsInStore() { // global $wpdb; // // return $wpdb->get_var( "SELECT COUNT(*) FROM `" . $wpdb->prefix . "posts` WHERE `post_type` IN ('product','product_variation') AND `post_status` IN ('publish', 'private', 'draft') " ); // } public static function getProductCountsInStore() { global $wpdb; return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}posts WHERE post_type IN ('product', 'product_variation') AND post_status IN ('publish', 'private', 'draft')" ) ); } //============================================================================================= public static function getSubscriptionInfo() { $businessName = ''; $credit = ''; $expireDate = ''; $plan = ''; $hesabix = new Ssbhesabix_Api(); $response = $hesabix->settingGetSubscriptionInfo(); if ( $response->Success ) { $businessName = $response->Result->Name; $credit = $response->Result->Credit; $expireDate = $response->Result->ExpireDate; $plan = $response->Result->Subscription; } return array( "businessName" => $businessName, "credit" => $credit, "expireDate" => $expireDate, "plan" => $plan ); } //============================================================================================= public static function ssbhesabix_set_webhook() { $url = get_site_url() . '/index.php?ssbhesabix_webhook=1&token=' . substr( wp_hash( AUTH_KEY . 'ssbhesabix/webhook' ), 0, 10 ); $hookPassword = get_option( 'ssbhesabix_webhook_password' ); $ssbhesabix_api = new Ssbhesabix_Api(); $response = $ssbhesabix_api->settingSetChangeHook( $url, $hookPassword ); if ( is_object( $response ) ) { if ( $response->Success ) { update_option( 'ssbhesabix_live_mode', 1 ); update_option( 'ssbhesabix_account_bid', $response->bid ); update_option( 'ssbhesabix_account_year', $response->year ); //set the last log ID if is not set $lastChanges = get_option( 'ssbhesabix_last_log_check_id' ); if ( ! $lastChanges ) { $lastChanges = 0; } $changes = $ssbhesabix_api->settingGetChanges( $lastChanges ); if ( $changes->Success ) { if ( get_option( 'ssbhesabix_last_log_check_id' ) == 0 ) { $lastChange = end( $changes->Result ); update_option( 'ssbhesabix_last_log_check_id', $lastChange->Id ); } } else { echo '
'; echo '

' . __( 'Cannot check the last change ID. Error Message: ', 'ssbhesabix' ) . $changes->ErrorMessage . '

'; echo '
'; HesabixLogService::log( array("Cannot check the last change ID. Error Message: $changes->ErrorMessage. Error Code: $changes->ErrorCode") ); } //check if date in fiscalYear if ( Ssbhesabix_Admin_Functions::isDateInFiscalYear( date( 'Y-m-d H:i:s' ) ) === 0 ) { echo '
'; echo '

' . __( 'The fiscal year has passed or not arrived. Please check the fiscal year settings in Hesabix.', 'ssbhesabix' ) . '

'; echo '
'; update_option( 'ssbhesabix_live_mode', 0 ); } //check the Hesabix default currency $default_currency = $ssbhesabix_api->settingGetCurrency(); if ( $default_currency->Success ) { $woocommerce_currency = get_woocommerce_currency(); $hesabix_currency = $default_currency->Result->moneyName; if ( $hesabix_currency == $woocommerce_currency || ( $hesabix_currency == 'IRR' && $woocommerce_currency == 'IRT' ) || ( $hesabix_currency == 'IRT' && $woocommerce_currency == 'IRR' ) ) { update_option( 'ssbhesabix_hesabix_default_currency', $hesabix_currency ); } else { update_option( 'ssbhesabix_hesabix_default_currency', 0 ); update_option( 'ssbhesabix_live_mode', 0 ); echo '
'; echo '

' . __( 'Hesabix and WooCommerce default currency must be same.', 'ssbhesabix' ); echo '

'; } } else { echo '
'; echo '

' . __( 'Cannot check the Hesabix default currency. Error Message: ', 'ssbhesabix' ) . $default_currency->ErrorMessage . '

'; echo '
'; HesabixLogService::log( array( "Cannot check the Hesabix default currency. Error Message: $default_currency->ErrorMessage. Error Code: $default_currency->ErrorCode" ) ); } if ( get_option( 'ssbhesabix_live_mode' ) ) { echo '
'; echo '

' . __( 'API Setting updated. Test Successfully', 'ssbhesabix' ) . '

'; echo '
'; } //add gift wrapping service $wpFaService = new HesabixWpFaService(); $wpFa = $wpFaService->getWpFa('gift_wrapping', 0); if(!$wpFa) { $gift_wrapping = $ssbhesabix_api->itemSave(array( 'name' => 'خدمات بسته بندی هدیه', 'khadamat' => 1, 'Tag' => json_encode(array('id_product' => 0, 'id_attribute' => 0)) )); if($gift_wrapping->Success) { $wpFa = new WpFa(); $wpFa->idPs = 0; $wpFa->idPsAttribute = 0; $wpFa->idHesabix = $gift_wrapping->code; $wpFa->objType = 'gift_wrapping'; $wpFaService->save($wpFa); $msg = 'Hesabix Gift wrapping service added successfully. Service Code: ' . $gift_wrapping->Result->Code; HesabixLogService::writeLogStr($msg); } else { $msg = 'Cannot set Gift wrapping service code. Error Message: ' . $gift_wrapping->ErrorMessage . ', Error Code: ' . $gift_wrapping->ErrorCode; HesabixLogService::writeLogStr($msg); } } } else { update_option( 'ssbhesabix_live_mode', 0 ); if ( $response->ErrorCode === 108 ) { echo '
'; echo '

' . __( 'Cannot connect to Hesabix. Business expired.', 'ssbhesabix' ) . $response->ErrorMessage . '

'; echo '
'; update_option( 'ssbhesabix_business_expired', 1 ); } else { echo '
'; echo '

' . __( 'Cannot set Hesabix webHook. Error Message:', 'ssbhesabix' ) . $response->ErrorMessage . '

'; echo '
'; update_option( 'ssbhesabix_business_expired', 0 ); } HesabixLogService::log( array("Cannot set Hesabix webHook. Error Message: $response->ErrorMessage. Error Code: $response->ErrorCode") ); } } else { update_option( 'ssbhesabix_live_mode', 0 ); echo '
'; echo '

' . __( 'Cannot connect to Hesabix servers. Please check your Internet connection', 'ssbhesabix' ) . '

'; echo '
'; HesabixLogService::log( array("Cannot connect to hesabix servers. Check your internet connection" ) ); } return $response; } //============================================================================================= public static function ssbhesabix_get_banks() { $ssbhesabix_api = new Ssbhesabix_Api(); $banks = $ssbhesabix_api->settingGetBanks(); if ( is_object( $banks ) && $banks->Success ) { $available_banks = array(); $available_banks[ - 1 ] = __( 'Choose', 'ssbhesabix' ); foreach ( $banks->Result as $bank ) { if ( $bank->Currency == get_woocommerce_currency() || ( get_woocommerce_currency() == 'IRT' && $bank->Currency == 'IRR' ) || ( get_woocommerce_currency() == 'IRR' && $bank->Currency == 'IRT' ) ) { $available_banks[ 'bank'.$bank->Code ] = $bank->Name . ' - ' . $bank->Branch . ' - ' . $bank->AccountNumber; } } if ( empty( $available_banks ) ) { $available_banks[0] = __( 'Define at least one bank in Hesabix', 'ssbhesabix' ); } return $available_banks; } else { update_option( 'ssbhesabix_live_mode', 0 ); echo '
'; echo '

' . __( 'Cannot get Banks detail.', 'ssbhesabix' ) . '

'; echo '
'; HesabixLogService::log( array("Cannot get banking information. Error Code: $banks->ErrorCode. Error Message: $banks->ErrorMessage." ) ); return array( '0' => __( 'Cannot get Banks detail.', 'ssbhesabix' ) ); } } //============================================================================================= public static function ssbhesabix_get_cashes() { $ssbhesabix_api = new Ssbhesabix_Api(); $cashes = $ssbhesabix_api->settingGetCashes(); if ( is_object( $cashes ) && $cashes->Success ) { $available_cashes = array(); foreach ( $cashes->Result as $cash ) { if ( $cash->Currency == get_woocommerce_currency() || ( get_woocommerce_currency() == 'IRT' && $cash->Currency == 'IRR' ) || ( get_woocommerce_currency() == 'IRR' && $cash->Currency == 'IRT' ) ) { $available_cashes[ 'cash'.$cash->Code ] = $cash->Name; } } return $available_cashes; } } //============================================================================================= public static function ssbhesabix_get_projects() { $ssbhesabix_api = new Ssbhesabix_Api(); $projects = $ssbhesabix_api->settingGetProjects(); if ( is_object( $projects ) && $projects->Success ) { $available_projects = array(); $available_projects[ - 1 ] = __( 'Choose', 'ssbhesabix' ); foreach ( $projects->data as $project ) { $available_projects[ $project->id ] = $project->name; } return $available_projects; } else { update_option( 'ssbhesabix_live_mode', 0 ); echo '
'; echo '

' . __( 'Cannot get Projects detail.', 'ssbhesabix' ) . '

'; echo '
'; HesabixLogService::log( array("Cannot get projects information. Error Code:$projects->ErrorCode. Error Message: $projects->ErrorMessage.") ); return array( '0' => __( 'Cannot get projects detail.', 'ssbhesabix' ) ); } } //============================================================================================= public static function ssbhesabix_get_salesmen() { $ssbhesabix_api = new Ssbhesabix_Api(); $salesmen = $ssbhesabix_api->settingGetSalesmen(); if ( is_object( $salesmen ) && $salesmen->Success ) { $available_salesmen = array(); $available_salesmen[ - 1 ] = __( 'Choose', 'ssbhesabix' ); foreach ( $salesmen->result as $salesman ) { $available_salesmen[ $salesman->code ] = $salesman->nikename; } return $available_salesmen; } else { update_option( 'ssbhesabix_live_mode', 0 ); echo '
'; echo '

' . __( 'Cannot get Salesmen detail.', 'ssbhesabix' ) . '

'; echo '
'; HesabixLogService::log( array("Cannot get salesmen information. Error Code: $salesmen->ErrorCode Error Message: .$salesmen->ErrorMessage.") ); return array( '0' => __( 'Cannot get salesmen detail.', 'ssbhesabix' ) ); } } //============================================================================================= public static function ssbhesabix_log_setting() { $cleanLogResult = ( isset( $_GET['cleanLogResult'] ) ) ? wc_clean( $_GET['cleanLogResult'] ) : null; if ( ! is_null( $cleanLogResult ) && $cleanLogResult === 'true' ) { echo '
'; echo '

' . __( 'The log file was cleared.', 'ssbhesabix' ) . '

'; echo '
'; } elseif ( $cleanLogResult === 'false' ) { echo '
'; echo '

' . __( 'Log file not found.', 'ssbhesabix' ) . '

'; echo '
'; } self::ssbhesabix_tab_log_html(); } //============================================================================================= public static function ssbhesabix_tab_log_html() { ?>
توجه فرمایید با زدن دکمه پاک کردن کل لاگ ها، تمامی فایل های لاگ ذخیره شده پاک می شوند.
در صورت نیاز به پاک کردن فایل لاگ جاری می توانید از دکمه پاک کردن لاگ جاری، زمانی که فایل لاگ مدنظر انتخاب شده است، استفاده کنید.
فهرست تاریخچه لاگ ها، لاگ های موجود در سیستم در بازه 10 روز گذشته را نمایش می دهد.

">





1000 ) { $fileSizeInMb = ( ( filesize( WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d") . '.txt' ) / 1000 ) / 1000 ); $fileSizeInMb = round( $fileSizeInMb, 2 ); $str = __( 'The log file size is large, clean log file.', 'ssbhesabix' ); echo '
' . '

' . $str . ' (' . $fileSizeInMb . 'MB)' . '

' . '
'; } else if ( file_exists( WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d") . '.txt' ) ) { $URL = WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d") . '.txt'; $logFileContent = HesabixLogService::readLog($URL); } echo '
'. '

' . __("Log History", "ssbhesabix") . '

    '; for($i = 0 ; $i < 10 ; $i++) { if( file_exists( WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d", strtotime(-$i."day")) . '.txt' ) ) { echo '
  • '; } } echo '
'; echo ''; echo '
'; //--------------------------------------- if(isset($_POST["changeLogFile"])) { echo ''; $URL = WP_CONTENT_DIR . '/ssbhesabix-' . $_POST["changeLogFile"] . '.txt'; $logFileContent = HesabixLogService::readLog($URL); echo '
'. '

' . __("Log History", "ssbhesabix") . '

    '; for($i = 0 ; $i < 10 ; $i++) { if( file_exists( WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d", strtotime(-$i."day")) . '.txt' ) ) { echo '
  • '; } } echo '
'; echo ''; echo '
'; } //--------------------------------------- if(isset($_POST["deleteLogFiles"])) { $prefix = WP_CONTENT_DIR . '/ssbhesabix-'; $files = glob($prefix . '*'); if ($files) { foreach ($files as $file) { if (is_file($file)) { if (unlink($file)) { header("refresh:0"); } else { HesabixLogService::writeLogStr("Unable to delete the file"); } } } } else { HesabixLogService::writeLogStr("No files found"); } } //--------------------------------------- if(isset($_POST["ssbhesabix-log-clean-submit"])) { if($_POST["currentLogFileDate"]) { $file = WP_CONTENT_DIR . '/ssbhesabix-' . $_POST["currentLogFileDate"] . '.txt'; } else { $file = WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d") . '.txt'; } if (is_file($file)) { if (unlink($file)) { HesabixLogService::writeLogStr("Selected Log File Deleted"); header("refresh:0"); } else { HesabixLogService::writeLogStr("Unable to delete the file"); } } } //--------------------------------------- if(isset($_POST["ssbhesabix-delete-logs-between-two-dates"])) { $startDate = $_POST["ssbhesabix_delete_log_date_from"]; $endDate = $_POST["ssbhesabix_delete_log_date_to"]; $directory = WP_CONTENT_DIR . '/ssbhesabix-'; $files = glob($directory . '*'); if($files) { foreach ($files as $file) { if(is_file($file)) { $fileDate = substr($file, strlen($directory), 10); $dateObj = DateTime::createFromFormat('Y-m-d', $fileDate); $startObj = DateTime::createFromFormat('Y-m-d', $startDate); $endObj = DateTime::createFromFormat('Y-m-d', $endDate); if ($dateObj >= $startObj && $dateObj <= $endObj) { HesabixLogService::writeLogStr("Log Files deleted"); unlink($file); } } } } header("refresh:0"); } //--------------------------------------- if(isset($_POST["ssbhesabix-find-log-submit"])) { echo ''; $URL = WP_CONTENT_DIR . '/ssbhesabix-' . $_POST["ssbhesabix_find_log_date"] . '.txt'; if ( file_exists( WP_CONTENT_DIR . '/ssbhesabix-' . $_POST["ssbhesabix_find_log_date"] . '.txt' ) && ( filesize( WP_CONTENT_DIR . '/ssbhesabix-' . $_POST["ssbhesabix_find_log_date"] . '.txt' ) / 1000 ) < 1000 ) { $logFileContent = HesabixLogService::readLog($URL); } echo '
'. '

' . __("Log History", "ssbhesabix") . '

    '; for($i = 0 ; $i < 10 ; $i++) { if( file_exists( WP_CONTENT_DIR . '/ssbhesabix-' . date("20y-m-d", strtotime(-$i."day")) . '.txt' ) ) { echo '
  • '; } } echo '
'; echo ''; echo '
'; } ?>
settingGetWarehouses(); if ( is_object( $warehouses->data ) ) { $available_warehouses = array(); $available_warehouses[ - 1 ] = __( 'Accounting quantity (Total inventory)', 'ssbhesabix' ); return $available_warehouses; } if ( is_object( $warehouses ) && $warehouses->Success ) { $available_warehouses = array(); $available_warehouses[ - 1 ] = __( 'Accounting quantity (Total inventory)', 'ssbhesabix' ); foreach ( $warehouses->data as $warehouse ) { $available_warehouses[ $warehouse->code ] = $warehouse->name; } return $available_warehouses; } else { update_option( 'ssbhesabix_live_mode', 0 ); echo '
'; echo '

' . __( 'Cannot get warehouses.', 'ssbhesabix' ) . '

'; echo '
'; HesabixLogService::log( array("Cannot get warehouses. Error Code: $warehouses->ErrorCode. Error Message: .$warehouses->ErrorMessage.") ); return array( '0' => __( 'Cannot get warehouses.', 'ssbhesabix' ) ); } } } Ssbhesabix_Setting::init();