Ok so its seems ive sorted myself for the total weight part
i added 2 fields
Weight
Quantity
Then used modified code from your snippets (thanks) but utilising excels SUMPRODUCT
=SUMPRODUCT(A2:A$row,B2:B$row)
below is what i used
add_action( 'woe_xls_print_footer', function ($objXls,$formatter) {
$row = $formatter->last_row;
// edit column names below!
$formatter->objPHPExcel->getActiveSheet()->getStyle( "D2" )->getFont()->setBold( true );
$formatter->objPHPExcel->getActiveSheet()->getStyle( "D3" )->getFont()->setBold( true );
$formatter->objPHPExcel->getActiveSheet()->setCellValue( "D2", "Total KG:" );
$formatter->objPHPExcel->getActiveSheet()->setCellValue( "D3", "=SUMPRODUCT(A2:A$row,B2:B$row)");
} ,10, 2);
-
This reply was modified 4 years, 9 months ago by prodograw.
-
This reply was modified 4 years, 9 months ago by prodograw.
-
This reply was modified 4 years, 9 months ago by prodograw.
but still would like on run_one_job
daterange “LAST MONTH”
if possible parsing “From Date” & “To Date” on the fly
-
This reply was modified 4 years, 9 months ago by prodograw.
-
This reply was modified 4 years, 9 months ago by prodograw.
Hi Alex,
ok so its just appending “from_date” & “to_date” on get params
I thought i would be able to add something to miscellaneous
-
This reply was modified 4 years, 9 months ago by prodograw.
you can try this version
add_filter('woe_settings_validate_defaults', function($settings){
$_time = current_time( "timestamp", 0 );
$_date = date( 'Y-m-d', $_time );
$last_month = strtotime( $_date . " -1 month" );
$settings['from_date'] = date( 'Y-m-01', $last_month );
$settings['to_date'] = date( 'Y-m-t', $last_month );
return $settings;
});
lol i was just doing it
/* ADD FOR ORDER EXPORTS RETURN LAST MONTH DATE RANGE ONLY ON PROFILE 5 */
if (strpos(home_url(add_query_arg(array($_GET), $wp->request)),'run_one_job&profile=5') !== false) {
add_filter('woe_settings_validate_defaults', function($settings){
$month_ini = new DateTime("first day of last month");
$month_end = new DateTime("last day of last month");
$from_date = $month_ini->format('Y-m-d');
$to_date = $month_end->format('Y-m-d');
$settings['from_date'] = $from_date;
$settings['to_date'] = $to_date;
return $settings;
});
}
no need to modify functions.php and check $wp->request
You can just edit profile #5 and put this code in “Misc Settings”