title: Model & Controller error on my website project
body: <p>Please help me, I cannot access my code it always shows the error:</p>
  <blockquote>
  <p>An uncaught Exception was encountered
  Type: ArgumentCountError</p>
  <p>Message: Too few arguments to function Quotation_model::addModels(), 1 passed in C:\xampp\htdocs\sangil\application\controllers\Quotation.php on line 126 and exactly 2 expected</p>
  <p>Filename: C:\xampp\htdocs\sangil\application\models\Quotation_model.php</p>
  <p>Line Number: 122</p>
  <p>Backtrace:</p>
  <p>File: C:\xampp\htdocs\sangil\application\controllers\Quotation.php
  Line: 126
  Function: addModels</p>
  <p>File: C:\xampp\htdocs\sangil\index.php
  Line: 315
  Function: require_once</p>
  </blockquote>
  <p>This is the code:</p>
  <p>Controller: Quotation.php</p>
  <pre><code>public function addQuotation()
  {
  
      $this-&gt;form_validation-&gt;set_rules('date', 'Date', 'trim|required');
      $this-&gt;form_validation-&gt;set_rules('reference_no', 'Reference No', 'trim|required');
      if ($this-&gt;form_validation-&gt;run() == false) {
  
          $this-&gt;add();
      } else {
          $warehouse_id = $this-&gt;input-&gt;post('warehouse', true);
          $data = array(
              &quot;date&quot;                =&gt;  $this-&gt;input-&gt;post('date'),
              &quot;reference_no&quot;        =&gt;  $this-&gt;input-&gt;post('reference_no'),
              &quot;warehouse_id&quot;        =&gt;  $this-&gt;input-&gt;post('warehouse'),
              &quot;customer_id&quot;         =&gt;  $this-&gt;input-&gt;post('customer'),
              &quot;biller_id&quot;           =&gt;  $this-&gt;input-&gt;post('biller'),
              &quot;total&quot;               =&gt;  $this-&gt;input-&gt;post('grand_total'),
              &quot;discount_value&quot;      =&gt;  $this-&gt;input-&gt;post('total_discount'),
              &quot;tax_value&quot;           =&gt;  $this-&gt;input-&gt;post('total_tax'),
              &quot;note&quot;                =&gt;  $this-&gt;input-&gt;post('note'),
              &quot;shipping_city_id&quot;    =&gt;  $this-&gt;input-&gt;post('city'),
              &quot;shipping_state_id&quot;   =&gt;  $this-&gt;input-&gt;post('state'),
              &quot;shipping_country_id&quot; =&gt;  $this-&gt;input-&gt;post('country'),
              &quot;shipping_address&quot;    =&gt;  $this-&gt;input-&gt;post('address'),
              &quot;shipping_charge&quot;     =&gt;  $this-&gt;input-&gt;post('shipping_charge'),
              &quot;internal_note&quot;       =&gt;  $this-&gt;input-&gt;post('internal_note'),
              &quot;mode_of_transport&quot;   =&gt;  $this-&gt;input-&gt;post('mode_of_transport'),
              &quot;transporter_name&quot;    =&gt;  $this-&gt;input-&gt;post('transporter_name'),
              &quot;transporter_code&quot;    =&gt;  $this-&gt;input-&gt;post('transporter_code'),
              &quot;vehicle_regn_no&quot;     =&gt;  $this-&gt;input-&gt;post('vehicle_regn_no'),
              &quot;user&quot;                =&gt;  $this-&gt;session-&gt;userdata('user_id')
          );
  
          if ($quotation_id = $this-&gt;quotation_model-&gt;addModel($data)) {
              $log_data = array(
                  'user_id'  =&gt; $this-&gt;session-&gt;userdata('user_id'),
                  'table_id' =&gt; $quotation_id,
                  'message'  =&gt; 'Quotation Inserted'
              );
              $this-&gt;log_model-&gt;insert_log($log_data);
              $sales_item_data = $this-&gt;input-&gt;post('table_data', true);
              $js_data = json_decode($sales_item_data);
              foreach ($js_data as $key =&gt; $value) {
                  if ($value == null) {
                  } else {
                      $product_id = $value-&gt;product_id;
                      $quantity = $value-&gt;quantity;
                      $data = array(
                          &quot;product_id&quot; =&gt; $value-&gt;product_id,
                          &quot;quantity&quot; =&gt; $value-&gt;quantity,
                          &quot;price&quot; =&gt; $value-&gt;price,
                          &quot;gross_total&quot; =&gt; $value-&gt;total,
                          &quot;discount_id&quot; =&gt; $value-&gt;discount_id,
                          &quot;discount_value&quot; =&gt; $value-&gt;discount_value,
                          &quot;discount&quot; =&gt; $value-&gt;discount,
                          &quot;tax_id&quot; =&gt; $value-&gt;tax_id,
                          &quot;tax_value&quot; =&gt; $value-&gt;tax_value,
                          &quot;tax&quot; =&gt; $value-&gt;tax,
                          &quot;quotation_id&quot; =&gt; $quotation_id
                      );
                      //$this-&gt;sales_model-&gt;checkProductInWarehouse($product_id,$quantity,$warehouse_id);
                      if ($this-&gt;quotation_model-&gt;addQuotationItem($data, $product_id, $warehouse_id, $quantity)) {
                      } else {
                      }
                  }
              }
              redirect('quotation/view/' . $quotation_id);
          } else {
              redirect('quotation', 'refresh');
          }
      }
  }
  </code></pre>
  <p>Model: Quotation_model.php</p>
  <pre><code>public function addModel($data, $invoice)
  {
      if ($this-&gt;db-&gt;insert('quotation', $data)) {
          return $this-&gt;db-&gt;insert_id();
      } else {
          return FALSE;
      }
  }
  </code></pre>