Ejemplo n.º 1
0
	public function anyExportPdf(){
		$id_template = 2;
		$arr_print = 	[
				'arr_list' =>	[
						'arr_key' => 	[
								'sku',
								'name',
								'company_name',
								'oum_name',
								'specification',
								'ton_kho',
								'origin_price',
								'invest'
								],
						'arr_head' => 	[
								['text'=>'Mã','class'=>''],
								['text'=>'Tên sản phẩm','class'=>''],
								['text'=>'Nhà cung cấp','class'=>''],
								['text'=>'Đơn vị','class'=>''],
								['text'=>'Quy cách','class'=>''],
								['text'=>'Tồn kho','class'=>''],
								['text'=>'Giá gốc','class'=>'money'],
								['text'=>'Vốn lưu','class'=>'money']
								],
						'arr_body'=>[],
						'arr_sum'=>[]
						],
				'arr_data'=>	[

						]
				];	
		if (\Cache::has('list_product'.\Auth::user()->id)){
			$arr_cache = \Cache::get('list_product'.\Auth::user()->id);
			$sum_invest = 0;
			foreach ($arr_cache as $key => $value) {
				$sum_invest += $value['origin_price']*$value['in_stock'];
				$arr_cache[$key]['ton_kho'] = floor($value['in_stock'] / $value['specification']).' '.$value['oum_name'];
				$arr_cache[$key]['invest'] = $value['origin_price']*$value['in_stock'];
				if($value['in_stock']%$value['specification'] && $value['specification']!=1){
					$sodu = $value['in_stock']%$value['specification'];
					$arr_cache[$key]['ton_kho'] .= ' + '.$sodu.' '.'cái';
				}
			}
			$arr_print['arr_list']['arr_sum'][] = [
				['value'=>'Tổng vốn lưu:','colspan'=>'7'],
				['value'=>$sum_invest]
			];
			$arr_print['arr_list']['arr_body'] = $arr_cache;
			$link = ExportsController::getCreatePrintPdf($arr_print,$id_template,'danh_sach_san_pham','landscape');
			return redirect($link);
		}
		die;
	}
Ejemplo n.º 2
0
	public function anyExportPdfDistributeYear(){
		$id_template = 24;
		$arr_print = 	[
				'arr_list' =>	[
						'arr_key' => 	[
								'name',
								'sum_invest',
								'sum_amount',
								'khoang_giam',
								'lai',
								'ty_le_lai',
								'loi_nhuan'
								],
						'arr_head' => 	[
								['text'=>'Công ty','class'=>''],
								['text'=>'Giá vốn','class'=>'money'],
								['text'=>'Doanh thu','class'=>'money'],
								['text'=>'Khoảng giảm','class'=>'money'],
								['text'=>'Lãi','class'=>'money'],
								['text'=>'Tỷ lệ lãi','class'=>'right strong'],
								['text'=>'Lợi nhuận','class'=>'money']
								],
						'arr_body'=>[],
						'arr_sum'=>[]
						],
				'arr_data'=>	[

						]
				];	
		if (\Cache::has('list_revenue_distribute_year'.\Auth::user()->id)){
			$arr_cache = \Cache::get('list_revenue_distribute_year'.\Auth::user()->id);
			$list_order = $arr_cache['list_order'];

			$arr_print['arr_data']['year'] = $arr_cache['year'];

			$total_sum_amount = 0;
			$total_sum_invest = 0;
			$total_khoang_giam = 0;
			$total_lai = 0;
			$total_loi_nhuan = 0;
			foreach ($list_order as $key => $value) {
				$list_order[$key]['date'] = date('d-m-Y',strtotime($value['date']));
				$list_order[$key]['ty_le_lai'] = number_format(($value['lai']/$value['sum_invest'])*100,2).'%';
				$total_sum_invest += $value['sum_invest'];
				$total_sum_amount += $value['sum_amount'];
				$total_lai += $value['lai'];
				$total_loi_nhuan += $value['loi_nhuan'];
				$total_khoang_giam +=  $value['khoang_giam'];
			}
			$arr_print['arr_list']['arr_sum'][] = [
				['value'=>'Tổng:','colspan'=>'1'],
				['value'=>$total_sum_invest],
				['value'=>$total_sum_amount],
				['value'=>$total_khoang_giam],
				['value'=>$total_lai],
				['value'=>'','class'=>'center'],
				['value'=>$total_loi_nhuan]
			];
			$arr_print['arr_list']['arr_sum'][] = [
				['value'=>'Chi khác:','colspan'=>'6'],
				['value'=>-$arr_cache['chi_khac']]
			];
			$arr_print['arr_list']['arr_sum'][] = [
				['value'=>'Lãi thực:','colspan'=>'6'],
				['value'=>$total_loi_nhuan - $arr_cache['chi_khac']]
			];
			$arr_print['arr_list']['arr_body'] = $list_order;
			$link = ExportsController::getCreatePrintPdf($arr_print,$id_template,'doanh_so_nha_cung_cap_nam_'.$arr_cache['year'],'potrait');
			return redirect($link);
		}
		die;
	}
	public function anyExportPdfList(){
		$id_template = 10;
		$arr_print = 	[
				'arr_list' =>	[
						'arr_key' => 	[
								'id',
								'company_name',
								'date',
								'status',
								'sum_amount'
								],
						'arr_head' => 	[
								['text'=>'Mã HĐ','class'=>''],
								['text'=>'Nhà cung cấp','class'=>''],
								['text'=>'Ngày trả hàng','class'=>''],
								['text'=>'Tình trạng','class'=>''],
								['text'=>'Tổng tiền','class'=>'money']
								],
						'arr_body'=>[],
						'arr_sum'=>[]
						],
				'arr_data'=>	[

						]
				];	
		if (\Cache::has('list_returnpurchaseorder'.\Auth::user()->id)){
			$arr_cache = \Cache::get('list_returnpurchaseorder'.\Auth::user()->id);
			$total_sum_amount = 0;
			foreach ($arr_cache as $key => $value) {
				$total_sum_amount += $value['sum_amount'];
				
				if($value['status']){
					$arr_cache[$key]['status'] = 'Hoàn thành';
				}else{
					$arr_cache[$key]['status'] = 'Mới';
				}
			}
			$arr_print['arr_list']['arr_sum'][] = [
				['value'=>'Tổng cộng:','colspan'=>'4'],
				['value'=>$total_sum_amount],
			];
			$arr_print['arr_list']['arr_body'] = $arr_cache;
			$link = ExportsController::getCreatePrintPdf($arr_print,$id_template,'danh_sach_tra_hang_ncc','potrait');
			return redirect($link);
		}
		die;
	}
Ejemplo n.º 4
0
	public function anyExportPdfCustomerYear(){
		$id_template = 14;
		$arr_print = 	[
				'arr_list' =>	[
						'arr_key' => 	[
								'company_name',
								'sum_amount',
								'paid',
								'no_cu',
								'con_lai'
								],
						'arr_head' => 	[
								['text'=>'Nhà cung cấp','class'=>''],
								['text'=>'Tổng tiền toa','class'=>'money'],
								['text'=>'Tiền thanh toán','class'=>'money'],
								['text'=>'Nợ cũ','class'=>'money'],
								['text'=>'Còn lại','class'=>'money']
								],
						'arr_body'=>[],
						'arr_sum'=>[]
						],
				'arr_data'=>	[

						]
				];	
		if (\Cache::has('list_receipt_customer_year'.\Auth::user()->id)){
			$arr_cache = \Cache::get('list_receipt_customer_year'.\Auth::user()->id);
			$list_order = $arr_cache['list_order'];
			$arr_print['arr_data']['year'] = $arr_cache['year'];
			$total_sum_amount = 0;
			$total_sum_paid = 0;
			$total_con_lai = 0;
			foreach ($list_order as $key => $value) {
				$total_sum_amount += $value['sum_amount'];
				$total_sum_paid += $value['paid'];
				$total_con_lai += $value['con_lai'];
			}
			$arr_print['arr_list']['arr_sum'][] = [
				['value'=>'Tổng:','colspan'=>'1'],
				['value'=>$total_sum_amount],
				['value'=>$total_sum_paid],
				['value'=>'','class'=>'center'],
				['value'=>$total_con_lai]
			];
			$arr_print['arr_list']['arr_body'] = $list_order;
			$link = ExportsController::getCreatePrintPdf($arr_print,$id_template,'cong_no_khach_hang_nam_'.$arr_cache['year'],'potrait');
			return redirect($link);
		}
		die;
	}