public static void edit_purchase_orders(to_purchase_orders to_purchase_orders) {
    try {
      Connection conn = MyConnection.connect();
      String s0 =
          "update purchase_orders set "
              + "po_no= '"
              + to_purchase_orders.po_no
              + "'"
              + ",user_name= '"
              + to_purchase_orders.user_name
              + "'"
              + ",session_no= '"
              + to_purchase_orders.session_no
              + "'"
              + ",date_added= '"
              + to_purchase_orders.date_added
              + "'"
              + ",remarks= '"
              + to_purchase_orders.remarks
              + "'"
              + "where "
              + " id ='"
              + to_purchase_orders.id
              + "' "
              + " ";

      PreparedStatement stmt = conn.prepareStatement(s0);
      stmt.execute();
      Lg.s(S1_purchase_orders.class, "Successfully Updated");
    } catch (Exception e) {
      throw new RuntimeException(e);
    } finally {
      MyConnection.close();
    }
  }
  public static void edit_user_previleges(to_user_previleges to_user_previleges) {
    try {
      Connection conn = MyConnection.connect();
      String s0 =
          "update user_previleges set "
              + "account= :account"
              + ",previledge= :previledge"
              + ",status= :status"
              + ",user_id= :user_id"
              + ",user_name= :user_name"
              + " where "
              + " id ='"
              + to_user_previleges.id
              + "' "
              + " ";

      s0 =
          SqlStringUtil.parse(s0)
              .setString("account", to_user_previleges.account)
              .setString("previledge", to_user_previleges.previledge)
              .setNumber("status", to_user_previleges.status)
              .setString("user_id", to_user_previleges.user_id)
              .setString("user_name", to_user_previleges.user_name)
              .ok();

      PreparedStatement stmt = conn.prepareStatement(s0);
      stmt.execute();
      Lg.s(User_previleges.class, "Successfully Updated");
    } catch (SQLException e) {
      throw new RuntimeException(e);
    } finally {
      MyConnection.close();
    }
  }
Exemple #3
0
  public static void update_reading(to_readings to_readings) {
    try {
      Connection conn = MyConnection.connect();
      String s0 =
          "update readings set "
              + " previous_reading= :previous_reading "
              + ",current_reading= :current_reading "
              + ",date_updated= :date_updated "
              + ",update_by_id= :update_by_id "
              + " where id='"
              + to_readings.id
              + "' "
              + " ";
      s0 =
          SqlStringUtil.parse(s0)
              .setNumber("previous_reading", to_readings.previous_reading)
              .setNumber("current_reading", to_readings.current_reading)
              .setString("date_updated", to_readings.date_updated)
              .setString("update_by_id", to_readings.update_by_id)
              .ok();

      PreparedStatement stmt = conn.prepareStatement(s0);
      stmt.execute();
      Lg.s(Readings.class, "Successfully Updated");
    } catch (SQLException e) {
      throw new RuntimeException(e);
    } finally {
      MyConnection.close();
    }
  }
  public static void delete_data(to_houses to_houses) {
    try {
      Connection conn = MyConnection.connect();
      String s0 = "delete from houses  " + " where id='" + to_houses.id + "' " + " ";

      PreparedStatement stmt = conn.prepareStatement(s0);
      stmt.execute();
      Lg.s(Houses.class, "Successfully Deleted");
    } catch (SQLException e) {
      throw new RuntimeException(e);
    } finally {
      MyConnection.close();
    }
  }
  public static void delete_purchase_orders(to_purchase_orders to_purchase_orders) {
    try {
      Connection conn = MyConnection.connect();
      String s0 =
          "delete from purchase_orders where " + " id ='" + to_purchase_orders.id + "' " + " ";

      PreparedStatement stmt = conn.prepareStatement(s0);
      stmt.execute();
      Lg.s(S1_purchase_orders.class, "Successfully Deleted");
    } catch (Exception e) {
      throw new RuntimeException(e);
    } finally {
      MyConnection.close();
    }
  }
  public static void add_data(to_skills to_skills) {
    try {
      Connection conn = MyConnection.connect();
      String s0 = "insert into skills(" + "skill" + ")values(" + ":skill" + ")";

      s0 = SqlStringUtil.parse(s0).setString("skill", to_skills.skill).ok();

      PreparedStatement stmt = conn.prepareStatement(s0);
      stmt.execute();
      Lg.s(Skills.class, "Successfully Added");
    } catch (SQLException e) {
      throw new RuntimeException(e);
    } finally {
      MyConnection.close();
    }
  }
  public static void update_data(to_skills to_skills) {
    try {
      Connection conn = MyConnection.connect();
      String s0 =
          "update skills set " + "skill= :skill " + " where id='" + to_skills.id + "' " + " ";

      s0 = SqlStringUtil.parse(s0).setString("skill", to_skills.skill).ok();

      PreparedStatement stmt = conn.prepareStatement(s0);
      stmt.execute();
      Lg.s(Skills.class, "Successfully Updated");
    } catch (SQLException e) {
      throw new RuntimeException(e);
    } finally {
      MyConnection.close();
    }
  }
  public static void delete_inv_sub_classifications(
      to_inv_sub_classifications to_inv_sub_classifications) {
    try {
      Connection conn = MyConnection.connect();
      String s0 =
          "delete from inv_sub_classifications where "
              + " id ='"
              + to_inv_sub_classifications.id
              + "' "
              + " ";

      PreparedStatement stmt = conn.prepareStatement(s0);
      stmt.execute();
      Lg.s(S1_inv_sub_classifications.class, "Successfully Deleted");
    } catch (SQLException e) {
      throw new RuntimeException(e);
    } finally {
      MyConnection.close();
    }
  }
  public static void add_user_previleges(List<to_user_previleges> to_user_previleges1) {
    try {
      Connection conn = MyConnection.connect();
      for (to_user_previleges to_user_previleges : to_user_previleges1) {
        String s0 =
            "insert into user_previleges("
                + "account"
                + ",previledge"
                + ",status"
                + ",user_id"
                + ",user_name"
                + ")values("
                + ":account"
                + ",:previledge"
                + ",:status"
                + ",:user_id"
                + ",:user_name"
                + ")";

        s0 =
            SqlStringUtil.parse(s0)
                .setString("account", to_user_previleges.account)
                .setString("previledge", to_user_previleges.previledge)
                .setNumber("status", to_user_previleges.status)
                .setString("user_id", to_user_previleges.user_id)
                .setString("user_name", to_user_previleges.user_name)
                .ok();

        PreparedStatement stmt = conn.prepareStatement(s0);
        stmt.execute();
        Lg.s(User_previleges.class, "Successfully Added");
      }

    } catch (SQLException e) {
      throw new RuntimeException(e);
    } finally {
      MyConnection.close();
    }
  }
  public static void add_inv_sub_classifications(
      to_inv_sub_classifications to_inv_sub_classifications) {
    try {
      Connection conn = MyConnection.connect();
      String s0 =
          "insert into inv_sub_classifications("
              + "category_id"
              + ",category_name"
              + ",classification_id"
              + ",classification_name"
              + ",sub_classification"
              + ")values("
              + ":category_id"
              + ",:category_name"
              + ",:classification_id"
              + ",:classification_name"
              + ",:sub_classification"
              + ")";

      s0 =
          SqlStringUtil.parse(s0)
              .setString("category_id", to_inv_sub_classifications.category_id)
              .setString("category_name", to_inv_sub_classifications.category_name)
              .setString("classification_id", to_inv_sub_classifications.classification_id)
              .setString("classification_name", to_inv_sub_classifications.classification_name)
              .setString("sub_classification", to_inv_sub_classifications.sub_classification)
              .ok();

      PreparedStatement stmt = conn.prepareStatement(s0);
      stmt.execute();
      Lg.s(S1_inv_sub_classifications.class, "Successfully Added");
    } catch (SQLException e) {
      throw new RuntimeException(e);
    } finally {
      MyConnection.close();
    }
  }
  public static void edit_inv_sub_classifications(
      to_inv_sub_classifications to_inv_sub_classifications) {
    try {
      Connection conn = MyConnection.connect();
      String s0 =
          "update inv_sub_classifications set "
              + "category_id= '"
              + to_inv_sub_classifications.category_id
              + "'"
              + ",category_name= '"
              + to_inv_sub_classifications.category_name
              + "'"
              + ",classification_id= '"
              + to_inv_sub_classifications.classification_id
              + "'"
              + ",classification_name= '"
              + to_inv_sub_classifications.classification_name
              + "'"
              + ",sub_classification= '"
              + to_inv_sub_classifications.sub_classification
              + "'"
              + "where "
              + " id ='"
              + to_inv_sub_classifications.id
              + "' "
              + " ";

      PreparedStatement stmt = conn.prepareStatement(s0);
      stmt.execute();
      Lg.s(S1_inv_sub_classifications.class, "Successfully Updated");
    } catch (SQLException e) {
      throw new RuntimeException(e);
    } finally {
      MyConnection.close();
    }
  }
  public static void add_purchase_orders(to_purchase_orders to_purchase_orders) {
    try {
      Connection conn = MyConnection.connect();
      String s0 =
          "insert into purchase_orders("
              + "po_no"
              + ",user_name"
              + ",session_no"
              + ",date_added"
              + ",remarks"
              + ")values("
              + ":po_no"
              + ",:user_name"
              + ",:session_no"
              + ",:date_added"
              + ",:remarks"
              + ")";

      s0 =
          SqlStringUtil.parse(s0)
              .setString("po_no", to_purchase_orders.po_no)
              .setString("user_name", to_purchase_orders.user_name)
              .setString("session_no", to_purchase_orders.session_no)
              .setString("date_added", to_purchase_orders.date_added)
              .setString("remarks", to_purchase_orders.remarks)
              .ok();

      PreparedStatement stmt = conn.prepareStatement(s0);
      stmt.execute();
      Lg.s(S1_purchase_orders.class, "Successfully Added");
    } catch (Exception e) {
      throw new RuntimeException(e);
    } finally {
      MyConnection.close();
    }
  }
  public static void update_data(
      to_household_member_vocational_experiences to_household_member_vocational_experiences) {
    try {
      Connection conn = MyConnection.connect();
      String s0 =
          "update household_member_vocational_experiences set "
              + "created_at= :created_at "
              + ",updated_at= :updated_at "
              + ",created_by= :created_by "
              + ",updated_by= :updated_by "
              + ",region= :region "
              + ",region_id= :region_id "
              + ",province= :province "
              + ",province_id= :province_id "
              + ",city= :city "
              + ",city_id= :city_id "
              + ",barangay= :barangay "
              + ",barangay_id= :barangay_id "
              + ",purok= :purok "
              + ",purok_id= :purok_id "
              + ",status= :status "
              + ",house_no= :house_no "
              + ",household_no= :household_no "
              + ",household_member_no= :household_member_no "
              + ",fname= :fname "
              + ",mname= :mname "
              + ",lname= :lname "
              + ",sname= :sname "
              + ",name_of_training= :name_of_training "
              + ",certificate_received= :certificate_received "
              + ",skills_required= :skills_required "
              + ",name_of_school= :name_of_school "
              + ",period_of_training= :period_of_training "
              + " where id='"
              + to_household_member_vocational_experiences.id
              + "' "
              + " ";

      s0 =
          SqlStringUtil.parse(s0)
              .setString("created_at", to_household_member_vocational_experiences.created_at)
              .setString("updated_at", to_household_member_vocational_experiences.updated_at)
              .setString("created_by", to_household_member_vocational_experiences.created_by)
              .setString("updated_by", to_household_member_vocational_experiences.updated_by)
              .setString("region", to_household_member_vocational_experiences.region)
              .setString("region_id", to_household_member_vocational_experiences.region_id)
              .setString("province", to_household_member_vocational_experiences.province)
              .setString("province_id", to_household_member_vocational_experiences.province_id)
              .setString("city", to_household_member_vocational_experiences.city)
              .setString("city_id", to_household_member_vocational_experiences.city_id)
              .setString("barangay", to_household_member_vocational_experiences.barangay)
              .setString("barangay_id", to_household_member_vocational_experiences.barangay_id)
              .setString("purok", to_household_member_vocational_experiences.purok)
              .setString("purok_id", to_household_member_vocational_experiences.purok_id)
              .setNumber("status", to_household_member_vocational_experiences.status)
              .setString("house_no", to_household_member_vocational_experiences.house_no)
              .setString("household_no", to_household_member_vocational_experiences.household_no)
              .setString(
                  "household_member_no",
                  to_household_member_vocational_experiences.household_member_no)
              .setString("fname", to_household_member_vocational_experiences.fname)
              .setString("mname", to_household_member_vocational_experiences.mname)
              .setString("lname", to_household_member_vocational_experiences.lname)
              .setString("sname", to_household_member_vocational_experiences.sname)
              .setString(
                  "name_of_training", to_household_member_vocational_experiences.name_of_training)
              .setString(
                  "certificate_received",
                  to_household_member_vocational_experiences.certificate_received)
              .setString(
                  "skills_required", to_household_member_vocational_experiences.skills_required)
              .setString(
                  "name_of_school", to_household_member_vocational_experiences.name_of_school)
              .setString(
                  "period_of_training",
                  to_household_member_vocational_experiences.period_of_training)
              .ok();

      PreparedStatement stmt = conn.prepareStatement(s0);
      stmt.execute();
      Lg.s(Household_member_vocational_experiences.class, "Successfully Updated");
    } catch (SQLException e) {
      throw new RuntimeException(e);
    } finally {
      MyConnection.close();
    }
  }
Exemple #14
0
  public static List<to_product> ret_data(String where) {
    List<to_product> datas = new ArrayList();

    try {
      Connection conn = MyConnection.connect2();
      String s0 =
          "select "
              + "lookup_code"
              + ",description"
              + ",reorder"
              + ",cost"
              + ",measured_in"
              + ",category"
              + ",catalog"
              + ",price"
              + " from overall_pos_db.product_inv_view  "
              + " "
              + where;
      Statement stmt = conn.createStatement();
      ResultSet rs = stmt.executeQuery(s0);
      while (rs.next()) {
        String lookup_code = rs.getString(1);
        String description = rs.getString(2);
        double reorder = rs.getDouble(3);
        double cost = rs.getDouble(4);
        String measure_in = rs.getString(5);
        String category = rs.getString(6);
        String catalog = rs.getString(7);
        double price = rs.getInt(8);

        System.out.println(
            lookup_code
                + " "
                + description
                + " "
                + cost
                + " "
                + measure_in
                + " "
                + category
                + " "
                + catalog
                + " "
                + price);

        String s2 =
            "insert into db_coop.items("
                + "barcode"
                + ",description"
                + ",generic_name"
                + ",category"
                + ",category_id"
                + ",classification"
                + ",classification_id"
                + ",sub_classification"
                + ",sub_classification_id"
                + ",product_qty"
                + ",unit"
                + ",conversion"
                + ",selling_price"
                + ",date_added"
                + ",user_name"
                + ",item_type"
                + ",status"
                + ",supplier"
                + ",fixed_price"
                + ",cost"
                + ",supplier_id"
                + ",multi_level_pricing"
                + ",vatable"
                + ",reorder_level"
                + ")values("
                + ":barcode"
                + ",:description"
                + ",:generic_name"
                + ",:category"
                + ",:category_id"
                + ",:classification"
                + ",:classification_id"
                + ",:sub_classification"
                + ",:sub_classification_id"
                + ",:product_qty"
                + ",:unit"
                + ",:conversion"
                + ",:selling_price"
                + ",:date_added"
                + ",:user_name"
                + ",:item_type"
                + ",:status"
                + ",:supplier"
                + ",:fixed_price"
                + ",:cost"
                + ",:supplier_id"
                + ",:multi_level_pricing"
                + ",:vatable"
                + ",:reorder_level"
                + ")";

        s2 =
            SqlStringUtil.parse(s2)
                .setString("barcode", lookup_code)
                .setString("description", description)
                .setString("generic_name", "")
                .setString("category", category)
                .setString("category_id", "")
                .setString("classification", "")
                .setString("classification_id", "")
                .setString("sub_classification", "")
                .setString("sub_classification_id", "")
                .setNumber("product_qty", 0)
                .setString("unit", measure_in)
                .setNumber("conversion", 1)
                .setNumber("selling_price", price)
                .setString("date_added", DateType.datetime.format(new Date()))
                .setString("user_name", "")
                .setString("item_type", "")
                .setNumber("status", 1)
                .setString("supplier", catalog)
                .setNumber("fixed_price", 0)
                .setNumber("cost", cost)
                .setString("supplier_id", "")
                .setNumber("multi_level_pricing", 0)
                .setNumber("vatable", 0)
                .setNumber("reorder_level", reorder)
                .ok();

        PreparedStatement stmt2 = conn.prepareStatement(s2);
        stmt2.execute();
        Lg.s(
            S1_items.class,
            "Successfully Added : " + lookup_code + " " + description + " : " + price);
      }
      return datas;
    } catch (SQLException e) {
      throw new RuntimeException(e);
    } finally {
      MyConnection.close();
    }
  }
Exemple #15
0
  public static void update_data(to_houses to_houses) {
    try {
      Connection conn = MyConnection.connect();
      String s0 =
          "update houses set "
              + "created_at= :created_at "
              + ",updated_at= :updated_at "
              + ",created_by= :created_by "
              + ",updated_by= :updated_by "
              + ",region= :region "
              + ",region_id= :region_id "
              + ",province= :province "
              + ",province_id= :province_id "
              + ",city= :city "
              + ",city_id= :city_id "
              + ",barangay= :barangay "
              + ",barangay_id= :barangay_id "
              + ",purok= :purok "
              + ",purok_id= :purok_id "
              + ",status= :status "
              + ",house_no= :house_no "
              + ",no_of_rooms= :no_of_rooms "
              + ",bldg_types= :bldg_types "
              + ",bldg_permit= :bldg_permit "
              + ",toilet_types= :toilet_types "
              + ",compartments= :compartments "
              + ",bathroom_types= :bathroom_types "
              + ",waste_disposal_methods= :waste_disposal_methods "
              + ",kitchen_types= :kitchen_types "
              + ",trans_types= :trans_types "
              + ",construction_roof_types= :construction_roof_types "
              + ",construction_wall_types= :construction_wall_types "
              + ",construction_floor_types= :construction_floor_types "
              + ",construction_communication_types= :construction_communication_types "
              + ",lighting_fuels= :lighting_fuels "
              + ",cooking_fuels= :cooking_fuels "
              + ",water_sources= :water_sources "
              + ",drinking_water_source_distance= :drinking_water_source_distance "
              + ",nearest_water_source_distance= :nearest_water_source_distance "
              + " where id='"
              + to_houses.id
              + "' "
              + " ";

      s0 =
          SqlStringUtil.parse(s0)
              .setString("created_at", to_houses.created_at)
              .setString("updated_at", to_houses.updated_at)
              .setString("created_by", to_houses.created_by)
              .setString("updated_by", to_houses.updated_by)
              .setString("region", to_houses.region)
              .setString("region_id", to_houses.region_id)
              .setString("province", to_houses.province)
              .setString("province_id", to_houses.province_id)
              .setString("city", to_houses.city)
              .setString("city_id", to_houses.city_id)
              .setString("barangay", to_houses.barangay)
              .setString("barangay_id", to_houses.barangay_id)
              .setString("purok", to_houses.purok)
              .setString("purok_id", to_houses.purok_id)
              .setNumber("status", to_houses.status)
              .setString("house_no", to_houses.house_no)
              .setNumber("no_of_rooms", to_houses.no_of_rooms)
              .setString("bldg_types", to_houses.bldg_types)
              .setString("bldg_permit", to_houses.bldg_permit)
              .setString("toilet_types", to_houses.toilet_types)
              .setString("compartments", to_houses.compartments)
              .setString("bathroom_types", to_houses.bathroom_types)
              .setString("waste_disposal_methods", to_houses.waste_disposal_methods)
              .setString("kitchen_types", to_houses.kitchen_types)
              .setString("trans_types", to_houses.trans_types)
              .setString("construction_roof_types", to_houses.construction_roof_types)
              .setString("construction_wall_types", to_houses.construction_wall_types)
              .setString("construction_floor_types", to_houses.construction_floor_types)
              .setString(
                  "construction_communication_types", to_houses.construction_communication_types)
              .setString("lighting_fuels", to_houses.lighting_fuels)
              .setString("cooking_fuels", to_houses.cooking_fuels)
              .setString("water_sources", to_houses.water_sources)
              .setNumber("drinking_water_source_distance", to_houses.drinking_water_source_distance)
              .setNumber("nearest_water_source_distance", to_houses.nearest_water_source_distance)
              .ok();

      PreparedStatement stmt = conn.prepareStatement(s0);
      stmt.execute();
      Lg.s(Houses.class, "Successfully Updated");
    } catch (SQLException e) {
      throw new RuntimeException(e);
    } finally {
      MyConnection.close();
    }
  }
Exemple #16
0
  public static void update_data(to_readings to_readings) {
    try {
      Connection conn = MyConnection.connect();
      String s0 =
          "update readings set "
              + "meter_reader_id= :meter_reader_id "
              + ",meter_reader_no= :meter_reader_no "
              + ",meter_reader_name= :meter_reader_name "
              + ",customer_id= :customer_id "
              + ",customer_no= :customer_no "
              + ",customer_name= :customer_name "
              + ",customer_tax_dec_no= :customer_tax_dec_no "
              + ",previous_reading= :previous_reading "
              + ",current_reading= :current_reading "
              + ",city= :city "
              + ",city_id= :city_id "
              + ",barangay= :barangay "
              + ",barangay_id= :barangay_id "
              + ",purok= :purok "
              + ",purok_id= :purok_id "
              + ",address= :address "
              + ",date_added= :date_added "
              + ",date_updated= :date_updated "
              + ",added_by_id= :added_by_id "
              + ",update_by_id= :update_by_id "
              + ",status= :status "
              + ",occupancy_id= :occupancy_id "
              + ",occupancy= :occupancy "
              + ",occupancy_type_id= :occupancy_type_id "
              + ",occupancy_type= :occupancy_type "
              + ",occupancy_type_code= :occupancy_type_code "
              + ",previous_reading_date= :previous_reading_date"
              + ",is_paid= :is_paid "
              + ",or_id= :or_id "
              + ",or_no= :or_no "
              + " where id='"
              + to_readings.id
              + "' "
              + " ";

      s0 =
          SqlStringUtil.parse(s0)
              .setString("meter_reader_id", to_readings.meter_reader_id)
              .setString("meter_reader_no", to_readings.meter_reader_no)
              .setString("meter_reader_name", to_readings.meter_reader_name)
              .setString("customer_id", to_readings.customer_id)
              .setString("customer_no", to_readings.customer_no)
              .setString("customer_name", to_readings.customer_name)
              .setString("customer_tax_dec_no", to_readings.customer_tax_dec_no)
              .setNumber("previous_reading", to_readings.previous_reading)
              .setNumber("current_reading", to_readings.current_reading)
              .setString("city", to_readings.city)
              .setString("city_id", to_readings.city_id)
              .setString("barangay", to_readings.barangay)
              .setString("barangay_id", to_readings.barangay_id)
              .setString("purok", to_readings.purok)
              .setString("purok_id", to_readings.purok_id)
              .setString("address", to_readings.address)
              .setString("date_added", to_readings.date_added)
              .setString("date_updated", to_readings.date_updated)
              .setString("added_by_id", to_readings.added_by_id)
              .setString("update_by_id", to_readings.update_by_id)
              .setNumber("status", to_readings.status)
              .setString("occupancy_id", to_readings.occupancy_id)
              .setString("occupancy", to_readings.occupancy)
              .setString("occupancy_type_id", to_readings.occupancy_type_id)
              .setString("occupancy_type", to_readings.occupancy_type)
              .setString("occupancy_type_code", to_readings.occupancy_type_code)
              .setString("previous_reading_date", to_readings.previous_reading_date)
              .setNumber("is_paid", to_readings.is_paid)
              .setString("or_id", to_readings.or_id)
              .setString("or_no", to_readings.or_no)
              .ok();

      PreparedStatement stmt = conn.prepareStatement(s0);
      stmt.execute();
      Lg.s(Readings.class, "Successfully Updated");
    } catch (SQLException e) {
      throw new RuntimeException(e);
    } finally {
      MyConnection.close();
    }
  }