优化打印

This commit is contained in:
乐风 2021-04-03 22:50:24 +08:00
parent bab69fb3a1
commit 4560ef7c93
5 changed files with 26 additions and 39 deletions

View File

@ -737,36 +737,28 @@ class OrderController extends WorkflowController
$template = DB::table('model_template')->where('id', $template_id)->first();
$print_type = $template['print_type'];
$this->layout = 'layouts.print_'.$print_type;
$print_tpl = view()->exists(Request::controller().'.print.'.$template_id);
$form = [
'template' => $template,
];
if ($print_tpl) {
$data = OrderService::getPrintData($id);
$data['form'] = $form;
$data['template'] = $template;
$tpl = $this->display($data, 'print/'.$template_id);
//return $tpl;
return $print_type == 'pdf' ? print_prince($tpl) : $tpl;
}
if ($print_type == 'stiReport') {
$data = OrderService::getPrintData($id);
$print_data = [
'master' => [$data['master']],
'money' => $data['money'],
'customer_order_data' => $data['rows'],
];
return $this->display([
'template' => $template,
'print_data' => $print_data,
]);
} else {
$print_tpl = view()->exists(Request::controller().'.print.'.$template_id);
if ($print_tpl) {
$data = OrderService::getPrintData($id);
$data['template'] = $template;
$tpl = $this->display($data, 'print/'.$template_id);
} else {
$tpl = $this->create('print');
}
return $print_type == 'pdf' ? print_prince($tpl) : $tpl;
}
$tpl = $this->create('print');
return $print_type == 'pdf' ? print_prince($tpl) : $tpl;
}
public function dialog()

View File

@ -44,6 +44,7 @@ class OrderService
')
->get();
$master['fee_money'] = 0;
return [
'master' => $master,
'rows' => $rows,

View File

@ -50,6 +50,7 @@
// 加载数据
var dataSet = new Stimulsoft.System.Data.DataSet("data");
dataSet.readJson(printData);
report.dictionary.clear();
report.regData("data", "data", dataSet);
report.dictionary.synchronize();

View File

@ -302,39 +302,31 @@ class DeliveryController extends WorkflowController
$template_id = Request::get('template_id');
$template = DB::table('model_template')->where('id', $template_id)->first();
$print_type = $template['print_type'];
// 存在打印模板
$print_tpl = view()->exists(Request::controller().'.print.'.$template_id);
$this->layout = 'layouts.print_'.$print_type;
$form = [
'template' => $template,
];
// 自定义模板
if ($print_tpl) {
$data = DeliveryService::getPrintData($id);
$data['form'] = $form;
$data['template'] = $template;
$tpl = $this->display($data, 'print/'.$template_id);
return $print_type == 'pdf' ? print_prince($tpl) : $tpl;
}
$this->layout = 'layouts.print_'.$print_type;
// 打印插件
if ($print_type == 'stiReport') {
$data = DeliveryService::getPrintData($id);
$print_data = [
'master' => [$data['master']],
'money' => $data['money'],
'stock_delivery_data' => $data['rows'],
];
return $this->display([
'template' => $template,
'print_data' => $print_data,
]);
} else {
$print_tpl = view()->exists(Request::controller().'.print.'.$template_id);
if ($print_tpl) {
$data = DeliveryService::getPrintData($id);
$data['template'] = $template;
$tpl = $this->display($data, 'print/'.$template_id);
} else {
$tpl = $this->create('print');
}
return $print_type == 'pdf' ? print_prince($tpl) : $tpl;
}
// 默认模板
$tpl = $this->create('print');
return $print_type == 'pdf' ? print_prince($tpl) : $tpl;
}
// 物流信息

View File

@ -53,9 +53,10 @@ class DeliveryService
->whereRaw("p.code = '99001'")
->sum("money");
$master['fee_money'] = $money;
return [
'master' => $master,
'money' => $money,
'rows' => $rows,
];
}