Commit 08698281 by hcy001

1

parent eb1555cd
......@@ -120,11 +120,15 @@ class ApiController extends Controller
//生成报价/销售 询价单
private function ApiAddInquiryReport($input, $id){
$InquiryItemsReportModel = new InquiryItemsReportModel();
$data = $InquiryItemsReportModel->addOffer($input);
if ($data[0] > 0){
Export($data);
if (@$_REQUEST["debug"] != 100){
$data = $InquiryItemsReportModel->addOffer($input);
if ($data[0] > 0){
Export($data);
}
$inquiry_id = $data[2]["inquiry_id"];
}else{
$inquiry_id = @$_REQUEST["inquiry_id"];
}
$inquiry_id = $data[2]["inquiry_id"];
$InquiryItemsReportModel->createSalePdf($inquiry_id);
}
......
......@@ -9,6 +9,19 @@ use DB;
//公共模型
class CommonModel extends Model
{
//获取客户详细信息
public function getUserDetail($com_id = "",$user_id = "")
{
$dbspu = DB::connection("liexin");
$Info = [];
if ($com_id != "") { #搜索公司
$Info = $dbspu->select("select com_name name,com_link_name cc,com_telphone tel,com_fax fax from lie_user_company where com_id = ".$com_id);
}
if ($user_id != "") { #搜索用户信息
$Info = $dbspu->select("select com_name name,com_link_name cc,com_telphone tel,com_fax fax from lie_user_main a,lie_user_company b where a.company_id=b.com_id and a.user_id = ".$user_id);
}
return count($Info) > 0 ? $Info[0] : false;
}
//获取汇率
public function getRate($k = "美元"){
$Redis= \RedisDB::connection();
......
......@@ -74,6 +74,21 @@ class InquiryItemsReportModel extends Model
if($inquiry_id == ""){
return [1001,"询价单号不得为空!"];
}
#主表信息
$mainArr = (new InquiryModel())->where("id",$inquiry_id)->first()->toArray();
#本公司信息
$company_info_origin = Config("website.company_info_origin");
$data["company"] = $company_info_origin[$mainArr["delivery_place"]]; #公司信息
#客户信息
$user = (new CommonModel())->getUserDetail($mainArr["com_id"],$mainArr["user_id"]);
if ($user === false){
$user = ["name"=>$mainArr["user_types"] == 1 ? $mainArr["user_name"]:$mainArr["com_name"] ];
}
$data["user"] = $user;
#询价明细
$itemsArr = $this->where("inquiry_id",$inquiry_id)->get()->toArray();
$quote_price_count = 0;
foreach ($itemsArr as $k=>&$v){
......@@ -84,14 +99,15 @@ class InquiryItemsReportModel extends Model
$data["quote_price_count"] = $quote_price_count;
$html = view('pdf.sale', $data)->render();
if (@$_REQUEST["flag"] == 100){
if (@$_REQUEST["debug"] == 100){
print_r($html);
die();
}
$name = 'sale_report_'.time().'.pdf';
PDF::loadHTML($html)
->setPaper('a4', 'landscape') //横列
// ->setPaper('a4', 'landscape') //横列
->setPaper('a4', 'portrait') //竖列
->setWarnings(false)
->save('pdf/'.$name);
......
......@@ -23,6 +23,9 @@ class LoginModel extends Model
* 检测登录
*/
public function checkLogin($request){
if (@$_REQUEST["debug"] == 100){
return ["user_id"=>1000,"user_name"=>"admin"];
}
$Redis= \RedisDB::connection();
//来自不一样的端,判断是否已经登录
......
......@@ -13,6 +13,21 @@ return [
'export_domain'=>'http://export.liexin.net', //通用导入导出网址
'frqapi_domain' => "http://frqapi.liexin.net", //接口网址
'company_info_origin'=>[ #原始公司信息
'1'=>[ #内地
'name'=>'猎芯科技有限公司',
'cc'=>'35353',
'fax'=>'5353535',
'tel'=>'13713025363',
],
'2'=>[ #香港
'name'=>'泽贸科技有限公司',
'cc'=>'35353',
'fax'=>'5353535',
'tel'=>'13713025363',
],
],
//允许跨域站点
'ALLOW_ORIGIN' => array(
'www.frq.liexin.com' ,
......
......@@ -6,7 +6,8 @@
<title>ichunt.com--{$data['order_sn']}</title>
<style type="text/css" media="screen">
*{ font-family: "simsun"; font-weight: normal;margin:0px;padding:0px; }
.pdf-box{margin:0 auto;font-size: 14px;color:#333;width:900px;padding:50px;}
/*.pdf-box{margin:0 auto;font-size: 14px;color:#333;width:900px;padding:50px;}*/
.pdf-box{margin:0 auto;font-size: 14px;color:#333;width:100%;padding:50px;}
.header{ text-align: center;font-size: 28px;color:#000; position: relative;}
.header img{width:120px;position: absolute;left:60px;top:10px;}
.bjdx{background: #ccffff;font-size: 28px;color:#0000DA;text-align: center;}
......@@ -19,6 +20,7 @@
.footer .pr30{position: relative;left:80px;}
.footer .pr60{position: relative;left:107px;}
.footer img{position: absolute;left: 731px;top: 40px;}
.table2{ width: 100%;}
</style>
</head>
<body>
......@@ -39,16 +41,16 @@
</tr>
<tr>
<td><b>Attn</b>:深圳市度申科技有限公司</td>
<td><b>C.C</b>:李美媛</td>
<td><b>Fax</b>:</td>
<td><b>Tel</b>: 0755-29823982</td>
<td><b>Attn</b>:{{ @$user["name"] }}</td>
<td><b>C.C</b>:{{ @$user["cc"] }}</td>
<td><b>Fax</b>:{{ @$user["fax"] }}</td>
<td><b>Tel</b>: {{ @$user["tel"] }}</td>
</tr>
<tr>
<td><b>From</b>:深圳市猎芯科技有限公司</td>
<td><b>C.C</b>:杨娟</td>
<td><b>Fax</b>:18529505446</td>
<td><b>Tel</b>: 0755-23485782-8031</td>
<td><b>From</b>:{{ @$company["name"] }}</td>
<td><b>C.C</b>:{{ @$company["cc"] }}</td>
<td><b>Fax</b>:{{ @$company["fax"] }}</td>
<td><b>Tel</b>: {{ @$company["tel"] }}</td>
</tr>
</table>
</div>
......@@ -82,6 +84,7 @@
<td>{{ @$v["quote_account"] }}</td>
<td>{{ @$v["delivery_time"] }}</td>
<td>{{ @$v["class_id2_name"] }}</td>
<td>{{ @$v["batch"] }}</td>
</tr>
@endforeach
@endif
......
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 sign in to comment