Author Topic: Receive & Check In - Not Working - Server Error  (Read 2569 times)

cswett

  • Jr. Member
  • **
  • Posts: 16
    • SmartChicken
Receive & Check In - Not Working - Server Error
« on: June 11, 2008, 07:42:43 am »
I have been working with trying out Calem here for a couple months now.  The only problems I'm having are with the Inventory Module.  I make my reqs and approve, then the PO and approve, then whenever I try to receive inventory... I select the PO and enter qty and price, choose my stock location, and then on the last screen input the qty to receive.... However, when I click "save" I get a window that pops up and says SERVER ERROR "An Error Happened In Server - Please Contact Your System Admin".

This also happens when I try to just use "Check In" as well.

I can make a physical inventory and check out parts to wo's.

I tried the Online Demo and it works fine there.   This happens to me on both 2.01 and 2.10 versions.  So I don't know if there might be a security or permissions problem with apache or mysql, but it puzzles me because all other modules and functions work.

Any help would be greatly appreciated!
Thanks
Casey

cswett

  • Jr. Member
  • **
  • Posts: 16
    • SmartChicken
Re: Receive & Check In - Not Working - Server Error
« Reply #1 on: June 11, 2008, 08:17:26 am »
Here is a snap shot of the LOG.... unknown column avg_unit_cost???
****************************************************

2008-06-11 09:12:59,231 DEBUG CalemPdo - Transaction already started for CalemDbo.update@381  by CalemDbo.beginTransaction@653
2008-06-11 09:12:59,231 ERROR CalemInDbo - Update exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'avg_unit_cost' in 'field list', errorInfo: array (
  0 => '42S22',
  1 => 1054,
  2 => 'Unknown column \'avg_unit_cost\' in \'field list\'',
)
2008-06-11 09:12:59,231 DEBUG CalemInDbo - errorInfo=array (
  0 => '42S22',
  1 => 1054,
  2 => 'Unknown column \'avg_unit_cost\' in \'field list\'',
), sql=update inventory set  avg_unit_cost = ?, modified_id = ?, modified_time = ? where id = '77590675-3b63-ecc4-95b4-d9819e48ecb1', changes=array (
  'id' => false,
  'avg_unit_cost' => true,
  'modified_id' => true,
  'modified_time' => true,
), row=array (
  'in_no' => '4UK12',
  'oemcode' => NULL,
  'qty_in_stock' => NULL,
  'description' => 'Epoxy Adhesive, Container Size 50 Milliliters, Shear Strength 3000 to 6000 PSI, Substrates Metals, Thermoplastic, Thermoset Plastic, Glass, Ceramic, Masonry, Paper/Hardboard, Work Life 120 Minutes, Ultra Strength, Non Sag Aerospace Grade, Amber ',
  'note' => 'Adhesive,Epoxy, Hysol E-120P Ultra-Strength',
  'ave_unit_cost' => NULL,
  'min_level' => NULL,
  'max_level' => NULL,
  'type_id' => 'b1040a2b-7223-7274-61a1-92379756e3f8',
  'category_id' => 'icg_part',
  'stock_type_id' => 'ist_stock',
  'valuation_type_id' => 'inv_avg',
  'abc_id' => 'in_abc_c',
  'abc_time' => '2008-05-27 21:57:52',
  'uom_id' => '10001',
  'rent_uom_id' => NULL,
  'rent_rate' => NULL,
  'qty_on_order' => '1',
  'qty_reserved' => NULL,
  'qty_to_order' => NULL,
  'order_gen_id' => 'inog_manual',
  'order_type_id' => 'in_order_demand',
  'reorder_point' => NULL,
  'reorder_qty' => '1',
  'owner_user_id' => NULL,
  'notification_id' => NULL,
  'costcode_id' => '21f82620-6690-a8c4-c510-173f3f05a77d',
  'modified_time' => '2008-06-11 14:12:59',
  'modified_id' => '01140f18-1657-3164-05c4-bd1367e8cd01',
  'created_time' => '2008-05-27 21:57:52',
  'created_id' => 'a364852c-a18b-b8d4-2551-3e46ccccfeeb',
  'id' => '77590675-3b63-ecc4-95b4-d9819e48ecb1',
  'avg_unit_cost' => 2.99,
)
2008-06-11 09:12:59,231 DEBUG CalemPdo - Rollback called by CalemDbo.rollback@657 , transaction stack=CalemDbo.beginTransaction@653 ,CalemDbo.update@381
2008-06-11 09:12:59,231 ERROR CalemInTranBo - Error in check out transaction: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'avg_unit_cost' in 'field list', tran=array (
  'in_id' => '77590675-3b63-ecc4-95b4-d9819e48ecb1',
  'receipt_no' => '1111111',
  'receive_type_id' => 'irf_credit',
  'qty' => '1',
  'unit_cost' => '2.99',
  'uom_id' => '10001',
  'costcode_id' => '21f82620-6690-a8c4-c510-173f3f05a77d',
  'tran_time' => '2008-06-11 13:34:00',
  'tran_user_id' => '01140f18-1657-3164-05c4-bd1367e8cd01',
  'store_user_id' => '01140f18-1657-3164-05c4-bd1367e8cd01',
  'qty_remaining' => '1',
  'receive_from_id' => '1111111',
  'location_id' => '7a996b93-8827-9ea4-1d9f-b7124b7b8459',
)

cswett

  • Jr. Member
  • **
  • Posts: 16
    • SmartChicken
Re: Receive & Check In - Not Working - Server Error
« Reply #2 on: June 11, 2008, 09:07:57 am »
Clip from CalemInCostAveBo.php.... is there a call here that is perhaps wrong or malformed for ave_unit_cost?

* At receive time, recalculate avgUnitCost
    */
   public function setUnitCostByReceive($inId, $rcUnitCost, $qty) {
      if ($qty==0) return; //Nothing to do.
      
      $inDbo=CalemFactory::getDbo('inventory');
      $inDbo->setIdForUpdate($inId);
      $inDbo->loadRecord();
      $unitCost=$inDbo->getValue('avg_unit_cost');
      //Now get the total qty in stock
      $total=$inDbo->getCountBySqlParam('select sum(qty) from in_stock where in_id=?', array($inId));
      if ($total+$qty==0) {
         $this->logger->info("Total qty is 0 so unit cost is not calculated: total=" . $total . ", qty=". $qty . ", inId=" . $inId);
         return;   
      }
      $newUnitCost=($total*$unitCost + $rcUnitCost*$qty)/($total+$qty);
      $inDbo->setValue('avg_unit_cost', $newUnitCost);
      $inDbo->update();
   }
   
   public function setUnitCostByCheckin($inId, $ciUnitCost, $qty) {
      $this->setUnitCostByReceive($inId, $ciUnitCost, $qty);
   }
}

cswett

  • Jr. Member
  • **
  • Posts: 16
    • SmartChicken
FIXED: Re: Receive & Check In - Not Working - Server Error
« Reply #3 on: June 11, 2008, 10:34:44 am »
Inventory Table had the avg_unit_cost as ave_unit_cost

Renamed table to AVG and good to go