-- ============================================
-- DFC FINAL FIX - Remove credit_sale and ensure correct structure
-- Run this to fix column count mismatch error
-- ============================================

-- Remove credit_sale column if it exists (it causes column count mismatch)
ALTER TABLE `dfc_entries` DROP COLUMN IF EXISTS `credit_sale`;

-- Ensure odc_cost_2 exists
ALTER TABLE `dfc_entries` 
ADD COLUMN IF NOT EXISTS `odc_cost_2` decimal(15,2) DEFAULT 0.00 AFTER `odc_cost`;

-- Verify table structure matches INSERT statement (32 columns excluding entry_id, created_at, updated_at)
-- Expected columns:
-- period_id, entry_date, cash_sale_net, catering_btc_regular, catering_btc_extra,
-- total_food_sale, housekeeping_lumpsum, laundry, total_sale,
-- cash_purchase, catering_cost, total_food_cost, food_cost_percent,
-- housekeeping_cost, housekeeping_cost_percent, manpower_days, manpower_cost,
-- manpower_cost_percent, manpower_cost_per_sale, odc_cost, odc_cost_2, cylinder_quantity,
-- cylinder_rate, total_cylinder_cost, cylinder_cost_percent, cylinder_cost_per_sale,
-- expected_food_cost, variation_amount, variation_type, additional_cost, total_cost, sr_no
