DataTables warning: table id=salesreport – Requested unknown parameter ‘0’ for row 0, column 0

“columns”: [{
title: “ID”,
width: “1%”
},
{
data: “item”,
render: function(data, type, row) {
return row.item;
},
width: “10%”
},
{
data: “total_OS”,
width: “5%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: “qty_P”,
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: “qty_DLI”,
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: “qty_DLIR”,
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: “qty_CN”,
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: “qty_PRO”,
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: “qty_CV_production”,
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: “qty_SA_excess”,
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: “qty_PS_production”,
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: function ( data, type, row ) {
return (parseFloat(data.total_OS)) + (parseFloat(data.total_p))
},
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: “qty_S”,
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: “qty_DLO”,
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: “qty_DLOR”,
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: “qty_DN”,
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: “qty_CV_consumption”,
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: “qty_SA_short”,
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: “qty_PS_consumption”,
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: “total_s”,
width: “10%”,
render: $.fn.dataTable.render.number(‘,’, ‘.’, $decimal_point, ”)
},
{
data: function ( data, type, row ) {
return ((parseInt(data.total_OS, 10) + parseInt(data.total_p, 10)) + (parseInt(data.total_s, 10)));
},
width: “10%”
},

                    ], this is controller   public function getStockCategoryToSalesReport(Request $request)

{

$invController = new invoiceController();
$is_permission = $invController->checkPermissions("stockcategory_to_sales", Role::LIST_PERMISSION);
if (!$is_permission) {
  Flash::error('You have no permission.');
  return redirect()->back();
}
$created_for = User::GetCreatedForID();
if ($request->get('user')) {
  $dealerId = $request->get('user');
  $dealer_det = Dealer::find($dealerId);
  $created_for = $dealer_det->userid;
}
/*if ($request->get('category') == 'DL') { 
  $item_data = InvoiceDetails::join('invoices', 'invoices.id', '=', 'invoice_details.invoice_id')
        ->join('items', 'items.id', '=', 'invoice_details.item_id')
        ->where("invoices.voucher_type", Invoice::DELIVERY_NOTE)
        ->whereIn("invoices.delivery_type", [Invoice::INWARD, Invoice::OUTWARD])
        ->whereBetween("invoices.inv_date", [$request->get('fromdate'), $request->get('todate')])
        ->where("invoices.created_for", $created_for)
        ->where("invoices.status", Role::STATUS_ACTIVE)
        ->whereNull("invoices.deleted_at")
        ->selectRaw('
          sum(case when invoice_details.qty > 0 then invoice_details.qty else 0 end) as qty_inward, 
          sum(case when invoice_details.qty < 0 then invoice_details.qty else 0 end) as qty_outward,
          invoice_details.rate as rate,items.item_name as item_name,
          sum(invoice_details.qty) as stock, 
          invoices.id as invoice_no')
        ->orderBy('items.item_name')
        ->groupBy('items.item_name')
        ->get();       
}*/

// $item_name = $request->get('item_name');

// dd($request->item_id);

// dd($request);
// $item_data = InvoiceDetails::join(‘invoices’, ‘invoices.id’, ‘=’, ‘invoice_details.invoice_id’)
// ->join(‘items’, ‘items.id’, ‘=’, ‘invoice_details.item_id’)
// ->whereIn(“invoices.voucher_type”, [Invoice::DELIVERY_NOTE, Invoice::SALES, Invoice::PURCHASES, Invoice::DEBIT_CREDIT_NOTE, Invoice::POS, Invoice::OPENING_STOCK, Invoice::CONVERSION, Invoice::STOCK_ADJUSTMENT, Invoice::PRODUCTION_SHEET, Invoice::PRODUCTION_ORDER])
// //->whereIn(“invoices.delivery_type”, [Invoice::INWARD, Invoice::OUTWARD])
// ->whereBetween(“invoices.inv_date”, [$request->get(‘fromdate’), $request->get(‘todate’)])
// ->where(“items.id”,$request->item_id)
// //->where(“invoices.created_for”, $created_for)
// // ->where(“items.item_name”)
// ->where(“invoices.status”, Role::STATUS_ACTIVE)
// ->whereNull(“invoices.deleted_at”)
// ->selectRaw(‘ invoices.inv_date as date,
// sum(case when invoice_details.qty > 0 and invoices.voucher_type = “P” then invoice_details.qty else 0 end) as qty_P,
// sum(case when invoices.voucher_type = “DL” and invoices.delivery_type = “inward” then invoice_details.qty else 0 end) as qty_DLI,
// sum(case when invoices.voucher_type = “DL” and invoices.delivery_type = “IR” then invoice_details.qty else 0 end) as qty_DLIR,
// sum(case when invoices.voucher_type = “DC” and invoices.delivery_type = “CN” then invoice_details.qty else 0 end) as qty_CN,

//           sum(case when invoice_details.qty > 0 and invoices.voucher_type = "PRO" then invoice_details.qty else 0 end) as qty_PRO,
//           sum(case when invoices.voucher_type = "CV" and invoices.delivery_type = "production" then invoice_details.qty else 0 end) as qty_CV_production,
//           sum(case when invoices.voucher_type = "SA" and invoices.delivery_type = "excess" then invoice_details.qty else 0 end) as qty_SA_excess,
//           sum(case when invoices.voucher_type = "PS" and invoices.delivery_type = "production" then invoice_details.qty else 0 end) as qty_PS_production,

//           sum(case when invoices.voucher_type = "POS" or invoices.voucher_type = "S" then invoice_details.qty else 0 end) as qty_S,
//           sum(case when invoices.voucher_type = "DL" and invoices.delivery_type = "outward" then invoice_details.qty else 0 end) as qty_DLO,
//           sum(case when invoices.voucher_type = "DL" and invoices.delivery_type = "OR" then invoice_details.qty else 0 end) as qty_DLOR, 
//           sum(case when invoices.voucher_type = "DC" and invoices.delivery_type = "DN" then invoice_details.qty else 0 end) as qty_DN,

//           sum(case when invoices.voucher_type = "CV" and invoices.delivery_type = "consumption" then invoice_details.qty else 0 end) as qty_CV_consumption,
//           sum(case when invoices.voucher_type = "SA" and invoices.delivery_type = "short" then invoice_details.qty else 0 end) as qty_SA_short,
//           sum(case when invoices.voucher_type = "PS" and invoices.delivery_type = "consumption" then invoice_details.qty else 0 end) as qty_PS_consumption,

//           sum(case when invoice_details.qty > 0 then invoice_details.qty else 0 end) as total_p,
//           sum(case when invoice_details.qty < 0 then invoice_details.qty else 0 end) as total_s,
//           sum(case when invoice_details.qty < 0 then invoice_details.qty else 0 end) as qty_outward,
          
//           invoice_details.rate as rate,items.item_name as item_name,
//           items.item_code as item_code,
//           case when items.item_code != "" then items.item_code else items.item_name end as item,
//           sum(invoice_details.qty) as stock, 
//           invoices.id as invoice_no, invoice_details.item_id as item_id')
//         ->orderBy('items.item_name')
//         ->groupBy('items.item_name');








$item_data = InvoiceDetails::join('invoices', 'invoices.id', '=', 'invoice_details.invoice_id')
->join('items', 'items.id', '=', 'invoice_details.item_id')
->join('stock_group','stock_group.id', '=', 'items.group_id')
->whereIn("invoices.voucher_type", [Invoice::DELIVERY_NOTE, Invoice::SALES, Invoice::PURCHASES, Invoice::DEBIT_CREDIT_NOTE, Invoice::POS, Invoice::OPENING_STOCK, Invoice::CONVERSION, Invoice::STOCK_ADJUSTMENT, Invoice::PRODUCTION_SHEET, Invoice::PRODUCTION_ORDER])
//->whereIn("invoices.delivery_type", [Invoice::INWARD, Invoice::OUTWARD])
->whereBetween("invoices.inv_date", [$request->get('fromdate'), $request->get('todate')])
->when($request->item_id !== null, function ($query) use ($request) {
  $query->where("items.id", $request->item_id);
})

->where(“stock_group.id”, $request->group_id)

//->where("invoices.created_for", $created_for)
// ->where("items.item_name")
->where("invoices.status", Role::STATUS_ACTIVE)
->whereNull("invoices.deleted_at")
->selectRaw(' invoices.inv_date as date,
  sum(case when invoice_details.qty > 0 and invoices.voucher_type = "P" then invoice_details.qty else 0 end) as qty_P,
  sum(case when invoices.voucher_type = "DL" and invoices.delivery_type = "inward" then invoice_details.qty else 0 end) as qty_DLI, 
  sum(case when invoices.voucher_type = "DL" and invoices.delivery_type = "IR" then invoice_details.qty else 0 end) as qty_DLIR,
  sum(case when invoices.voucher_type = "DC" and invoices.delivery_type = "CN" then invoice_details.qty else 0 end) as qty_CN,

  sum(case when invoice_details.qty > 0 and invoices.voucher_type = "PRO" then invoice_details.qty else 0 end) as qty_PRO,
  sum(case when invoices.voucher_type = "CV" and invoices.delivery_type = "production" then invoice_details.qty else 0 end) as qty_CV_production,
  sum(case when invoices.voucher_type = "SA" and invoices.delivery_type = "excess" then invoice_details.qty else 0 end) as qty_SA_excess,
  sum(case when invoices.voucher_type = "PS" and invoices.delivery_type = "production" then invoice_details.qty else 0 end) as qty_PS_production,

  sum(case when invoices.voucher_type = "POS" or invoices.voucher_type = "S" then invoice_details.qty else 0 end) as qty_S,
  sum(case when invoices.voucher_type = "DL" and invoices.delivery_type = "outward" then invoice_details.qty else 0 end) as qty_DLO,
  sum(case when invoices.voucher_type = "DL" and invoices.delivery_type = "OR" then invoice_details.qty else 0 end) as qty_DLOR, 
  sum(case when invoices.voucher_type = "DC" and invoices.delivery_type = "DN" then invoice_details.qty else 0 end) as qty_DN,

  sum(case when invoices.voucher_type = "CV" and invoices.delivery_type = "consumption" then invoice_details.qty else 0 end) as qty_CV_consumption,
  sum(case when invoices.voucher_type = "SA" and invoices.delivery_type = "short" then invoice_details.qty else 0 end) as qty_SA_short,
  sum(case when invoices.voucher_type = "PS" and invoices.delivery_type = "consumption" then invoice_details.qty else 0 end) as qty_PS_consumption,

  sum(case when invoice_details.qty > 0 then invoice_details.qty else 0 end) as total_p,
  sum(case when invoice_details.qty < 0 then invoice_details.qty else 0 end) as total_s,
  sum(case when invoice_details.qty < 0 then invoice_details.qty else 0 end) as qty_outward,
  
  invoice_details.rate as rate,items.item_name as item_name,
  items.item_code as item_code,
  case when items.item_code != "" then items.item_code else items.item_name end as item,
  sum(invoice_details.qty) as stock, 
  invoices.id as invoice_no, invoice_details.item_id as item_id')
->orderBy('items.item_name')
->groupBy('items.item_name');





        //->get();     
//sum(case when invoices.voucher_type = "OS" then invoice_details.qty else 0 end) as total_OS, 
if(Auth::user()->role_id == Role::ROLE_DEALER){
  $item_data = $item_data->where("invoices.created_for", $created_for)->get();
} else if(Auth::user()->role_id == Role::ROLE_ADMIN) {
  $users = User::where('created_id', $created_for)->pluck('id');
  $item_data = $item_data->whereIn("invoices.created_for", $users)->get();
} else if(Auth::user()->role_id == Role::ROLE_MUlTI) {
  $user = Auth::user()->parent_id;
  $users = explode(',', $user);
  $item_data = $item_data->whereIn("invoices.created_for", $users)->get();
}
/*$opening_stock = InvoiceDetails::join('invoices', 'invoices.id', '=', 'invoice_details.invoice_id')
  ->join('items', 'items.id', '=', 'invoice_details.item_id')
  ->where("invoices.voucher_type", Invoice::OPENING_STOCK)
  ->where("invoices.inv_date", "<",$request->get('fromdate'))
  //->where("invoices.created_for", $created_for)
  ->where("invoices.status", Role::STATUS_ACTIVE)
  ->whereNull("invoices.deleted_at")
  ->selectRaw('
      sum(case when invoices.voucher_type = "OS" then invoice_details.qty else 0 end) as total_OS,
      items.item_name as item_name,
      items.item_code as item_code,
      case when items.item_code != "" then items.item_code else items.item_name end as item, 
      invoices.id as invoice_no, invoice_details.item_id as item_id')
  ->orderBy('items.item_name')
  ->groupBy('items.item_name');
  //->get(); */ 
$opening_stock = InvoiceDetails::join('invoices', 'invoices.id', '=', 'invoice_details.invoice_id')
  ->join('items', 'items.id', '=', 'invoice_details.item_id')
  //->where("invoices.voucher_type", Invoice::OPENING_STOCK)
  //->whereNotIn("invoices.voucher_type", [Invoice::SALES_ORDER, Invoice::PURCHASES_ORDER])
  ->where("invoices.inv_date", "<",$request->get('fromdate'))
  //->where("invoices.created_for", $created_for)
  ->where("invoices.status", Role::STATUS_ACTIVE)
  ->where("invoice_details.status", Role::STATUS_ACTIVE)
  ->whereNull("invoices.deleted_at")
  ->selectRaw('sum(invoice_details.qty) as total_OS,
      items.item_name as item_name,
      items.item_code as item_code,
      case when items.item_code != "" then items.item_code else items.item_name end as item, 
      invoices.id as invoice_no, invoice_details.item_id as item_id')
  ->orderBy('items.item_name')
  ->groupBy('items.item_name');
  //->get();      
if(Auth::user()->role_id == Role::ROLE_DEALER){
  $opening_stock = $opening_stock->where("invoices.created_for", $created_for)->get();
} else if(Auth::user()->role_id == Role::ROLE_ADMIN) {
  $users = User::where('created_id', $created_for)->pluck('id');
  $opening_stock = $opening_stock->whereIn("invoices.created_for", $users)->get();
} else if(Auth::user()->role_id == Role::ROLE_MUlTI) {
  $user = Auth::user()->parent_id;
  $users = explode(',', $user);
  $opening_stock = $opening_stock->whereIn("invoices.created_for", $users)->get();
}
$array_data = [];
foreach($item_data as $item_data){
  foreach($opening_stock as $stock){
    if($item_data->item_id == $stock->item_id){
      $data = array_merge($item_data->toArray(),$stock->toArray());
      array_push($array_data, $data);
    } 
  }  
} 
return $array_data; 
//return Response::json($item_data);

}enter image description here

i am trying to solve the error that is arising…. i need to solve that error

New contributor

Jancy Merin Samson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật