Commit 5d77782e authored by hangjun83's avatar hangjun83

财务开票模块更新

parent 31fa0570
......@@ -203,7 +203,7 @@ class InvoiceService
$applyInvoiceItems = [];
$applyInvoiceItems['fphxz'] = 0;
$applyInvoiceItems['hsbz'] = 1; //默认含税
$applyInvoiceItems['spmc'] = $item['item_name'];
$applyInvoiceItems['spmc'] = $this->charsetToGBK($item['item_name']);
$applyInvoiceItems['spbm'] = '1070214010000000000';//$item['p_code'];
$applyInvoiceItems['ggxh'] = $item['item_spec'];
$applyInvoiceItems['dw'] = $item['item_unit'];
......
......@@ -142,4 +142,26 @@ trait Helpers
fclose($cvs_file);
}
function charsetToGBK($mixed)
{
if (is_array($mixed)) {
foreach ($mixed as $k => $v) {
if (is_array($v)) {
$mixed[$k] = $this->charsetToGBK($v);
} else {
$encode = mb_detect_encoding($v, array('ASCII', 'UTF-8', 'GB2312', 'GBK', 'BIG5'));
if ($encode == 'UTF-8') {
$mixed[$k] = iconv('UTF-8', 'GBK', $v);
}
}
}
} else {
$encode = mb_detect_encoding($mixed, array('ASCII', 'UTF-8', 'GB2312', 'GBK', 'BIG5'));
if ($encode == 'UTF-8') {
$mixed = iconv('UTF-8', 'GBK', $mixed);
}
}
return $mixed;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment