gpt4 book ai didi

php - 哪个联接适合我在 CI 中的 Ajax 数据表

转载 作者:IT老高 更新时间:2023-10-29 00:01:29 25 4
gpt4 key购买 nike

我有两张 table ,一张是“销售”,另一张是“送货”。我有一份显示所有“销售”的报告。我想做一个连接,在那里我可以获得与交付表相比未交付的所有销售,只有 ID 是唯一的关键点。虽然我是 CI 的新开发人员,但我想知道如何去做。

以下是网格中返回值的代码。

function getdatatableajax()
{
if($this->input->get('search_term')) { $search_term = $this->input->get('search_term'); } else { $search_term = false;}

$this->load->library('datatables');
$this->datatables
->select("sales.id as sid, date, reference_no, biller_name, customer_name, total_tax, total_tax2, total, internal_note")
->select("sales.id = deliveries.id as sid date, reference_no, biller_name, customer_name, total_tax, total_tax2, total, internal_note")
->from('sales');
$this->datatables->add_column("Actions",
"<center><a href='#' title='$2' class='tip' data-html='true'><i class='icon-folder-close'></i></a> <a href='#' onClick=\"MyWindow=window.open('index.php?module=sales&view=view_invoice&id=$1', 'MyWindow','toolbar=0,location=0,directories=0,status=0,menubar=yes,scrollbars=yes,resizable=yes,width=1000,height=600'); return false;\" title='".$this->lang->line("view_invoice")."' class='tip'><i class='icon-fullscreen'></i></a>
<a href='index.php?module=sales&view=add_delivery&id=$1' title='".$this->lang->line("add_delivery_order")."' class='tip'><i class='icon-road'></i></a>
<a href='index.php?module=sales&view=pdf&id=$1' title='".$this->lang->line("download_pdf")."' class='tip'><i class='icon-file'></i></a>
<a href='index.php?module=sales&view=email_invoice&id=$1' title='".$this->lang->line("email_invoice")."' class='tip'><i class='icon-envelope'></i></a>
</center>", "sid, internal_note")

->unset_column('sid')
->unset_column('internal_note');

echo $this->datatables->generate();

}

Deliveries 表包含以下文件

id date time reference_no customer address note user updated_by

我只想要警报代码,如果适用的话,它可以在任何地方工作。

最佳答案

试试这个代码,它应该可以工作。

function getdatatableajax()
{
if($this->input->get('search_term')) { $search_term = $this->input->get('search_term'); } else { $search_term = false;}

$this->load->library('datatables');
$this->datatables
->select("sales.id as sid, sales.date as date, sales.reference_no as reference_no, sales.biller_name as biller_name, sales.customer_name as customer_name, sales.total_tax as total_tax, sales.total_tax2 as total_tax2, sales.total as total, internal_note as sintnote")
->from('sales')
->join(deliveries, 'sales.reference_no = deliveries.reference_no', 'left');
$this->datatables->add_column("Actions",
"<center><a href='#' title='$2' class='tip' data-html='true'><i class='icon-folder-close'></i></a> <a href='#' onClick=\"MyWindow=window.open('index.php?module=sales&view=view_invoice&id=$1', 'MyWindow','toolbar=0,location=0,directories=0,status=0,menubar=yes,scrollbars=yes,resizable=yes,width=1000,height=600'); return false;\" title='".$this->lang->line("view_invoice")."' class='tip'><i class='icon-fullscreen'></i></a>
<a href='index.php?module=sales&view=add_delivery&id=$1' title='".$this->lang->line("add_delivery_order")."' class='tip'><i class='icon-road'></i></a>
<a href='index.php?module=sales&view=pdf&id=$1' title='".$this->lang->line("download_pdf")."' class='tip'><i class='icon-file'></i></a>
<a href='index.php?module=sales&view=email_invoice&id=$1' title='".$this->lang->line("email_invoice")."' class='tip'><i class='icon-envelope'></i></a>
</center>", "sid, internal_note")

->unset_column('sid')
->unset_column('internal_note');
echo $this->datatables->generate();

}

关于php - 哪个联接适合我在 CI 中的 Ajax 数据表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33091551/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com