| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806 |
- # encoding: UTF-8
- # This file is auto-generated from the current state of the database. Instead
- # of editing this file, please use the migrations feature of Active Record to
- # incrementally modify your database, and then regenerate this schema definition.
- #
- # Note that this schema.rb definition is the authoritative source for your
- # database schema. If you need to create the application database on another
- # system, you should be using db:schema:load, not running all the migrations
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
- # you'll amass, the slower it'll run and the greater likelihood for issues).
- #
- # It's strongly recommended that you check this file into your version control system.
- ActiveRecord::Schema.define(version: 20181122030513) do
- # These are extensions that must be enabled in order to support this database
- enable_extension "plpgsql"
- create_table "audits", force: :cascade do |t|
- t.integer "auditable_id"
- t.string "auditable_type"
- t.integer "associated_id"
- t.string "associated_type"
- t.integer "user_id"
- t.string "user_type"
- t.string "username"
- t.string "action"
- t.text "audited_changes"
- t.integer "version", default: 0
- t.string "comment"
- t.string "remote_address"
- t.string "request_uuid"
- t.datetime "created_at"
- end
- add_index "audits", ["associated_id", "associated_type"], name: "associated_index", using: :btree
- add_index "audits", ["auditable_id", "auditable_type"], name: "auditable_index", using: :btree
- add_index "audits", ["created_at"], name: "index_audits_on_created_at", using: :btree
- add_index "audits", ["request_uuid"], name: "index_audits_on_request_uuid", using: :btree
- add_index "audits", ["user_id", "user_type"], name: "user_index", using: :btree
- create_table "available_products", force: :cascade do |t|
- t.integer "product_id"
- t.integer "pointsale_id"
- t.decimal "stock_min", default: 0.0
- t.decimal "stock_max", default: 0.0
- t.decimal "stock", default: 0.0
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.decimal "price_sale", precision: 10, scale: 2
- t.integer "products_variant_id"
- end
- add_index "available_products", ["pointsale_id"], name: "index_available_products_on_pointsale_id", using: :btree
- add_index "available_products", ["product_id"], name: "index_available_products_on_product_id", using: :btree
- create_table "billing_informations", force: :cascade do |t|
- t.integer "customer_id", default: 0, null: false
- t.string "name", limit: 255, default: "", null: false
- t.string "rfc", limit: 13, default: "", null: false
- t.string "address", limit: 255, default: "", null: false
- t.integer "zipcode", default: 0, null: false
- t.string "num_ext", default: "", null: false
- t.string "num_int", default: "", null: false
- t.integer "state_id", default: 0, null: false
- t.integer "county_id", default: 0, null: false
- t.string "city", default: "", null: false
- t.string "suburb", default: "", null: false
- t.integer "status", default: 1, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "supplier_id", default: 0, null: false
- end
- add_index "billing_informations", ["county_id"], name: "index_billing_informations_on_county_id", using: :btree
- add_index "billing_informations", ["customer_id"], name: "index_billing_informations_on_customer_id", using: :btree
- add_index "billing_informations", ["state_id"], name: "index_billing_informations_on_state_id", using: :btree
- create_table "cash_out_details", force: :cascade do |t|
- t.integer "cash_out_id"
- t.integer "payment_method_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.decimal "incoming", precision: 10, scale: 2, default: 0.0, null: false
- t.decimal "total", precision: 10, scale: 2, default: 0.0, null: false
- t.decimal "adjustment", precision: 10, scale: 2, default: 0.0, null: false
- t.text "observations"
- t.decimal "outgoing", precision: 10, scale: 2, default: 0.0, null: false
- end
- add_index "cash_out_details", ["cash_out_id"], name: "index_cash_out_details_on_cash_out_id", using: :btree
- add_index "cash_out_details", ["payment_method_id"], name: "index_cash_out_details_on_payment_method_id", using: :btree
- create_table "cash_outs", force: :cascade do |t|
- t.integer "open_cash_register_id"
- t.integer "user_id"
- t.decimal "amount_in", null: false
- t.decimal "amount_out", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "received_by_id"
- t.decimal "received_cash", precision: 10, scale: 2, default: 0.0
- t.decimal "cash_fund", precision: 10, scale: 2, default: 0.0
- t.decimal "physical_cash", precision: 10, scale: 2, default: 0.0, null: false
- t.string "observations"
- end
- add_index "cash_outs", ["open_cash_register_id"], name: "index_cash_outs_on_open_cash_register_id", using: :btree
- add_index "cash_outs", ["user_id"], name: "index_cash_outs_on_user_id", using: :btree
- create_table "cash_registers", force: :cascade do |t|
- t.string "name"
- t.text "description"
- t.integer "pointsale_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "main", default: 0, null: false
- t.integer "status", default: 1, null: false
- end
- create_table "cash_registers_moves", force: :cascade do |t|
- t.integer "open_cash_register_id"
- t.integer "payment_method_id"
- t.decimal "quantity", default: 0.0, null: false
- t.string "move_type", limit: 1, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "sale_id"
- t.integer "cardnumber"
- t.integer "purchase_id"
- t.integer "expense_id"
- t.integer "concept"
- t.string "ticket"
- t.integer "status", default: 1, null: false
- t.decimal "received", precision: 10, scale: 2
- t.decimal "change", precision: 10, scale: 2
- t.integer "products_return_id"
- t.integer "credit_payment_id"
- end
- add_index "cash_registers_moves", ["open_cash_register_id"], name: "index_cash_registers_moves_on_open_cash_register_id", using: :btree
- add_index "cash_registers_moves", ["payment_method_id"], name: "index_cash_registers_moves_on_payment_method_id", using: :btree
- create_table "categories", force: :cascade do |t|
- t.string "category"
- t.text "description"
- t.integer "status", default: 1
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "parent_id", default: 0, null: false
- end
- create_table "categories_products", id: false, force: :cascade do |t|
- t.integer "product_id"
- t.integer "category_id"
- end
- add_index "categories_products", ["category_id"], name: "index_categories_products_on_category_id", using: :btree
- add_index "categories_products", ["product_id"], name: "index_categories_products_on_product_id", using: :btree
- create_table "commissions", force: :cascade do |t|
- t.decimal "commission_total"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "pointsale_id"
- t.integer "user_id"
- t.datetime "initial_date", null: false
- t.datetime "final_date", null: false
- end
- add_index "commissions", ["pointsale_id"], name: "index_commissions_on_pointsale_id", using: :btree
- create_table "contacts", force: :cascade do |t|
- t.string "name", limit: 255, default: "", null: false
- t.string "last_name", limit: 255, default: "", null: false
- t.string "phone", limit: 30, default: "", null: false
- t.string "email", limit: 255, default: "", null: false
- t.text "notes", default: "", null: false
- t.integer "status", default: 1, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
- create_table "credit_payments", force: :cascade do |t|
- t.integer "customer_id"
- t.integer "credit_id"
- t.integer "pointsale_id"
- t.decimal "quantity", precision: 10, scale: 2, default: 0.0, null: false
- t.integer "status", default: 0, null: false
- t.date "date_payment", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "user_id"
- end
- add_index "credit_payments", ["credit_id"], name: "index_credit_payments_on_credit_id", using: :btree
- add_index "credit_payments", ["customer_id"], name: "index_credit_payments_on_customer_id", using: :btree
- add_index "credit_payments", ["pointsale_id"], name: "index_credit_payments_on_pointsale_id", using: :btree
- create_table "credits", force: :cascade do |t|
- t.integer "customer_id"
- t.integer "pointsale_id"
- t.integer "sale_id"
- t.decimal "total", precision: 10, scale: 2, default: 0.0, null: false
- t.decimal "rest", precision: 10, scale: 2, default: 0.0, null: false
- t.integer "status", default: 0, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.string "credit_note"
- end
- add_index "credits", ["customer_id"], name: "index_credits_on_customer_id", using: :btree
- add_index "credits", ["pointsale_id"], name: "index_credits_on_pointsale_id", using: :btree
- add_index "credits", ["sale_id"], name: "index_credits_on_sale_id", using: :btree
- create_table "customers", force: :cascade do |t|
- t.string "nick_name", limit: 255, default: "", null: false
- t.string "phone", limit: 30, default: "", null: false
- t.string "email", limit: 255, default: "", null: false
- t.boolean "credit", default: true, null: false
- t.decimal "credit_limit", precision: 10, scale: 2, default: 0.0, null: false
- t.integer "time_limit", default: 0, null: false
- t.text "notes", default: "", null: false
- t.integer "status", default: 1, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "contact_id"
- t.integer "is_public", default: 0
- end
- create_table "expenses", force: :cascade do |t|
- t.integer "expensesconcept_id"
- t.integer "open_cash_register_id"
- t.decimal "quantity", default: 0.0, null: false
- t.integer "status", default: 1, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.text "observations"
- t.date "expense_date"
- t.string "expense_code"
- end
- add_index "expenses", ["expensesconcept_id"], name: "index_expenses_on_expensesconcept_id", using: :btree
- add_index "expenses", ["open_cash_register_id"], name: "index_expenses_on_open_cash_register_id", using: :btree
- create_table "expensesconcepts", force: :cascade do |t|
- t.string "name"
- t.string "description"
- t.boolean "allpoints"
- t.integer "status", default: 1
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "expense_from_purchase", default: 0, null: false
- end
- create_table "expensesconcepts_pointsales", id: false, force: :cascade do |t|
- t.integer "expensesconcept_id"
- t.integer "pointsale_id"
- end
- create_table "inventories", force: :cascade do |t|
- t.integer "pointsale_id"
- t.integer "user_id"
- t.date "inventory_date"
- t.text "notes"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
- add_index "inventories", ["pointsale_id"], name: "index_inventories_on_pointsale_id", using: :btree
- add_index "inventories", ["user_id"], name: "index_inventories_on_user_id", using: :btree
- create_table "inventories_moves", force: :cascade do |t|
- t.integer "inventory_id"
- t.integer "product_id"
- t.integer "purchase_id"
- t.integer "sale_id"
- t.decimal "quantity", default: 0.0, null: false
- t.string "move_type", limit: 1, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "reason"
- t.integer "transfer_id"
- end
- add_index "inventories_moves", ["inventory_id"], name: "index_inventories_moves_on_inventory_id", using: :btree
- add_index "inventories_moves", ["product_id"], name: "index_inventories_moves_on_product_id", using: :btree
- add_index "inventories_moves", ["purchase_id"], name: "index_inventories_moves_on_purchase_id", using: :btree
- add_index "inventories_moves", ["sale_id"], name: "index_inventories_moves_on_sale_id", using: :btree
- create_table "open_cash_registers", force: :cascade do |t|
- t.integer "cash_register_id"
- t.integer "user_id"
- t.decimal "initial_cash", precision: 10, scale: 2, default: 0.0
- t.decimal "final_cash", precision: 10, scale: 2, default: 0.0
- t.integer "status", default: 0
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
- add_index "open_cash_registers", ["cash_register_id"], name: "index_open_cash_registers_on_cash_register_id", using: :btree
- add_index "open_cash_registers", ["user_id"], name: "index_open_cash_registers_on_user_id", using: :btree
- create_table "payment_methods", force: :cascade do |t|
- t.string "method", null: false
- t.integer "status", default: 1, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "reference"
- t.integer "isCash", default: 0, null: false
- end
- create_table "pointsales", force: :cascade do |t|
- t.string "name"
- t.string "address"
- t.text "notes"
- t.integer "status", default: 1
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.text "prefix"
- t.string "img_pointsale_file_name"
- t.string "img_pointsale_content_type"
- t.integer "img_pointsale_file_size"
- t.datetime "img_pointsale_updated_at"
- t.string "ticket_footer"
- t.string "img_pointsale"
- t.decimal "haggle_percent", precision: 10, scale: 2, default: 0.0
- end
- create_table "pos_configs", force: :cascade do |t|
- t.integer "cancel_partial_payment"
- t.integer "refund_sale"
- t.integer "days_cancel_sale"
- t.integer "days_cancel_purchase"
- t.decimal "tax_percent"
- t.string "time_zone", limit: 255, default: "", null: false
- t.decimal "gain_margin"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.text "ticket_description"
- t.integer "days_cancel_reserved"
- t.decimal "reserve_sale_percent", precision: 10, scale: 2
- t.integer "commission_percent"
- t.string "ticket_footer"
- t.string "ticket_img_file_name"
- t.string "ticket_img_content_type"
- t.integer "ticket_img_file_size"
- t.datetime "ticket_img_updated_at"
- t.integer "haggle_in_sale_percent"
- t.string "ticket_img"
- t.boolean "enable_haggle", default: true
- end
- create_table "pre_purchases", force: :cascade do |t|
- t.integer "supplier_id"
- t.integer "user_id"
- t.integer "pointsale_id"
- t.integer "product_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.decimal "amount", default: 0.0, null: false
- t.decimal "tax", default: 0.0, null: false
- t.decimal "total", default: 0.0, null: false
- t.integer "quantity", default: 0, null: false
- t.integer "warehouse_id"
- t.decimal "price_base", precision: 10, scale: 2
- t.decimal "exchange", precision: 10, scale: 2
- end
- create_table "pre_sales", force: :cascade do |t|
- t.integer "customer_id"
- t.integer "user_id"
- t.integer "open_cash_register_id"
- t.integer "product_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "sale_type", limit: 2
- t.decimal "amount", default: 0.0, null: false
- t.decimal "tax", default: 0.0, null: false
- t.decimal "discount", default: 0.0, null: false
- t.decimal "total", default: 0.0, null: false
- t.integer "quantity", default: 0, null: false
- t.integer "special_price_id"
- t.decimal "unit_price", precision: 10, scale: 2
- t.decimal "haggle", precision: 10, scale: 2, default: 0.0
- t.integer "promotion_id"
- t.decimal "unit_price_w_discount", precision: 10, scale: 2
- t.integer "haggle_percent", default: 0
- end
- create_table "pre_transfers", force: :cascade do |t|
- t.integer "origin_id"
- t.integer "destiny_id"
- t.integer "user_id"
- t.integer "product_id"
- t.integer "quantity", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "origin_is_pointsale", null: false
- t.integer "destiny_is_pointsale", null: false
- end
- add_index "pre_transfers", ["destiny_id"], name: "index_pre_transfers_on_destiny_id", using: :btree
- add_index "pre_transfers", ["origin_id"], name: "index_pre_transfers_on_origin_id", using: :btree
- add_index "pre_transfers", ["product_id"], name: "index_pre_transfers_on_product_id", using: :btree
- add_index "pre_transfers", ["user_id"], name: "index_pre_transfers_on_user_id", using: :btree
- create_table "product_wastes", force: :cascade do |t|
- t.integer "product_id"
- t.decimal "quantity", precision: 10, scale: 2, default: 0.0, null: false
- t.string "reason", default: "", null: false
- t.integer "status", default: 0, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "user_id"
- t.integer "pointsale_id"
- t.integer "warehouse_id"
- t.integer "products_return_in_id"
- end
- add_index "product_wastes", ["product_id"], name: "index_product_wastes_on_product_id", using: :btree
- create_table "products", force: :cascade do |t|
- t.string "sku", limit: 30, default: "", null: false
- t.string "name", limit: 255, default: "", null: false
- t.text "description", default: "", null: false
- t.decimal "price_base", precision: 10, scale: 2, default: 0.0
- t.decimal "price_sale", precision: 10, scale: 2, default: 0.0
- t.string "img_product_file_name"
- t.string "img_product_content_type"
- t.integer "img_product_file_size"
- t.datetime "img_product_updated_at"
- t.boolean "presentation", default: false, null: false
- t.boolean "inventory", default: true, null: false
- t.decimal "content"
- t.integer "status", default: 1, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "unit_id"
- t.integer "include_purchase_tax", default: 0, null: false
- t.integer "include_sale_tax", default: 0, null: false
- t.string "barcode"
- t.integer "parent_id"
- t.text "attributes_json"
- t.boolean "is_parent", default: false
- t.boolean "is_in_dollars", default: false
- t.decimal "price_base_dollars", precision: 10, scale: 2
- t.string "img_product"
- t.integer "category_id"
- end
- add_index "products", ["unit_id"], name: "index_products_on_unit_id", using: :btree
- create_table "products_return_ins", force: :cascade do |t|
- t.integer "products_return_id"
- t.integer "product_id", null: false
- t.decimal "quantity", null: false
- t.string "reason"
- t.boolean "is_wasted", default: false
- t.decimal "amount", default: 0.0
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
- add_index "products_return_ins", ["product_id"], name: "index_products_return_ins_on_product_id", using: :btree
- add_index "products_return_ins", ["products_return_id"], name: "index_products_return_ins_on_products_return_id", using: :btree
- create_table "products_return_outs", force: :cascade do |t|
- t.integer "products_return_id"
- t.integer "product_id", null: false
- t.decimal "quantity", null: false
- t.decimal "amount", default: 0.0
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
- add_index "products_return_outs", ["product_id"], name: "index_products_return_outs_on_product_id", using: :btree
- add_index "products_return_outs", ["products_return_id"], name: "index_products_return_outs_on_products_return_id", using: :btree
- create_table "products_returns", force: :cascade do |t|
- t.integer "sale_id"
- t.integer "user_id"
- t.string "return_code", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "pointsale_id", null: false
- t.decimal "new_amount", precision: 10, scale: 2, default: 0.0
- t.decimal "returned_amount", precision: 10, scale: 2, default: 0.0
- t.decimal "difference_amount", precision: 10, scale: 2, default: 0.0
- t.boolean "is_money_returned", default: false
- end
- add_index "products_returns", ["sale_id"], name: "index_products_returns_on_sale_id", using: :btree
- add_index "products_returns", ["user_id"], name: "index_products_returns_on_user_id", using: :btree
- create_table "products_variants", force: :cascade do |t|
- t.integer "product_id"
- t.text "attributes_json", null: false
- t.string "sku", limit: 30, default: "", null: false
- t.string "barcode"
- t.decimal "price_sale", precision: 10, scale: 2
- t.integer "status"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
- add_index "products_variants", ["product_id"], name: "index_products_variants_on_product_id", using: :btree
- create_table "promotions", force: :cascade do |t|
- t.date "start_date", null: false
- t.date "end_date", null: false
- t.decimal "percent", default: 0.0
- t.integer "product_id"
- t.integer "category_id"
- t.integer "user_id"
- t.integer "status", default: 1, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "subcategory_id"
- end
- add_index "promotions", ["category_id"], name: "index_promotions_on_category_id", using: :btree
- add_index "promotions", ["product_id"], name: "index_promotions_on_product_id", using: :btree
- add_index "promotions", ["user_id"], name: "index_promotions_on_user_id", using: :btree
- create_table "purchase_details", force: :cascade do |t|
- t.integer "purchase_id"
- t.integer "product_id"
- t.integer "quantity"
- t.decimal "price", precision: 10, scale: 2, default: 0.0, null: false
- t.decimal "amount", precision: 10, scale: 2, default: 0.0, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "status", default: 1, null: false
- t.decimal "tax", null: false
- end
- add_index "purchase_details", ["product_id"], name: "index_purchase_details_on_product_id", using: :btree
- add_index "purchase_details", ["purchase_id"], name: "index_purchase_details_on_purchase_id", using: :btree
- create_table "purchases", force: :cascade do |t|
- t.integer "supplier_id"
- t.integer "pointsale_id"
- t.string "purchase_code"
- t.decimal "amount", precision: 10, scale: 2, default: 0.0
- t.decimal "tax", precision: 10, scale: 2, default: 0.0
- t.decimal "total", precision: 10, scale: 2, default: 0.0
- t.text "observations"
- t.date "purchase_date"
- t.string "user_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "status", default: 0, null: false
- t.integer "warehouse_id"
- t.boolean "is_in_dollars", default: false
- t.decimal "exchange", precision: 10, scale: 2
- end
- create_table "sales", force: :cascade do |t|
- t.integer "customer_id"
- t.integer "user_id"
- t.integer "open_cash_register_id"
- t.decimal "amount", precision: 10, scale: 2, default: 0.0, null: false
- t.decimal "tax", precision: 10, scale: 2, default: 0.0, null: false
- t.decimal "discount", precision: 10, scale: 2, default: 0.0, null: false
- t.decimal "total", precision: 10, scale: 2, default: 0.0, null: false
- t.integer "status", default: 1, null: false
- t.date "date_sale", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "saletype", limit: 2
- t.integer "seller_id"
- t.string "sale_code"
- t.date "expiration_date"
- t.string "credit_note"
- end
- add_index "sales", ["customer_id"], name: "index_sales_on_customer_id", using: :btree
- add_index "sales", ["open_cash_register_id"], name: "index_sales_on_open_cash_register_id", using: :btree
- add_index "sales", ["user_id"], name: "index_sales_on_user_id", using: :btree
- create_table "sales_details", force: :cascade do |t|
- t.integer "sale_id"
- t.integer "product_id"
- t.decimal "quantity", null: false
- t.decimal "amount", precision: 10, scale: 2, default: 0.0, null: false
- t.decimal "tax", precision: 10, scale: 2, default: 0.0, null: false
- t.decimal "discount", precision: 10, scale: 2, default: 0.0, null: false
- t.decimal "total", precision: 10, scale: 2, default: 0.0, null: false
- t.integer "status", default: 1, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "special_price_id"
- t.decimal "unit_price", precision: 10, scale: 2
- t.decimal "unit_price_w_discount", precision: 10, scale: 2
- t.decimal "haggle", precision: 10, scale: 2, default: 0.0
- t.decimal "haggle_percent", precision: 10, scale: 2, default: 0.0
- end
- add_index "sales_details", ["product_id"], name: "index_sales_details_on_product_id", using: :btree
- add_index "sales_details", ["sale_id"], name: "index_sales_details_on_sale_id", using: :btree
- create_table "sales_sellercommissions", force: :cascade do |t|
- t.integer "sellerscommission_id"
- t.integer "sale_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
- add_index "sales_sellercommissions", ["sale_id"], name: "index_sales_sellercommissions_on_sale_id", using: :btree
- add_index "sales_sellercommissions", ["sellerscommission_id"], name: "index_sales_sellercommissions_on_sellerscommission_id", using: :btree
- create_table "sellers", force: :cascade do |t|
- t.integer "pointsale_id"
- t.string "name", null: false
- t.string "last_name", null: false
- t.integer "status", default: 1, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
- add_index "sellers", ["pointsale_id"], name: "index_sellers_on_pointsale_id", using: :btree
- create_table "sellerscommissions", force: :cascade do |t|
- t.integer "commission_id"
- t.integer "seller_id"
- t.integer "num_sales"
- t.decimal "sales_total"
- t.decimal "commission_calculated"
- t.decimal "commission_paid"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "commission_percent"
- t.decimal "total_sold_cash", precision: 10, scale: 2, default: 0.0
- t.decimal "total_sold_credits_apartments", precision: 10, scale: 2, default: 0.0
- t.decimal "income_by_cash", precision: 10, scale: 2, default: 0.0
- t.decimal "income_by_reserved_and_credits", precision: 10, scale: 2, default: 0.0
- end
- add_index "sellerscommissions", ["commission_id"], name: "index_sellerscommissions_on_commission_id", using: :btree
- add_index "sellerscommissions", ["seller_id"], name: "index_sellerscommissions_on_seller_id", using: :btree
- create_table "special_prices", force: :cascade do |t|
- t.integer "product_id"
- t.integer "customer_id"
- t.decimal "price", precision: 10, scale: 2
- t.decimal "percent"
- t.integer "status", default: 1, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "user_id"
- end
- add_index "special_prices", ["customer_id"], name: "index_special_prices_on_customer_id", using: :btree
- add_index "special_prices", ["product_id"], name: "index_special_prices_on_product_id", using: :btree
- create_table "spmx_counties", force: :cascade do |t|
- t.integer "id_", null: false
- t.integer "state_id"
- t.string "name", null: false
- end
- add_index "spmx_counties", ["state_id"], name: "index_spmx_counties_on_state_id", using: :btree
- create_table "spmx_states", force: :cascade do |t|
- t.string "name", null: false
- end
- create_table "storers", force: :cascade do |t|
- t.integer "user_id"
- t.integer "warehouse_id"
- t.string "name", null: false
- t.string "last_name", null: false
- t.integer "status", default: 1, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
- add_index "storers", ["user_id"], name: "index_storers_on_user_id", using: :btree
- add_index "storers", ["warehouse_id"], name: "index_storers_on_warehouse_id", using: :btree
- create_table "suppliers", force: :cascade do |t|
- t.string "nick_name", limit: 255, default: "", null: false
- t.string "phone", limit: 30, default: "", null: false
- t.string "email", limit: 255, default: "", null: false
- t.text "notes", default: "", null: false
- t.integer "contact_id"
- t.integer "status", default: 1, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
- add_index "suppliers", ["contact_id"], name: "index_suppliers_on_contact_id", using: :btree
- create_table "taggings", force: :cascade do |t|
- t.integer "tag_id"
- t.integer "taggable_id"
- t.string "taggable_type"
- t.integer "tagger_id"
- t.string "tagger_type"
- t.string "context", limit: 128
- t.datetime "created_at"
- end
- add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree
- add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree
- create_table "tags", force: :cascade do |t|
- t.string "name"
- t.integer "taggings_count", default: 0
- end
- add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree
- create_table "transfer_details", force: :cascade do |t|
- t.integer "transfer_id"
- t.integer "product_id"
- t.decimal "quantity", precision: 10, scale: 2, default: 0.0, null: false
- t.integer "status", default: 1, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "adjustment"
- t.integer "has_looses", default: 0
- t.integer "has_surplus", default: 0
- end
- add_index "transfer_details", ["product_id"], name: "index_transfer_details_on_product_id", using: :btree
- add_index "transfer_details", ["transfer_id"], name: "index_transfer_details_on_transfer_id", using: :btree
- create_table "transfers", force: :cascade do |t|
- t.integer "origin_id"
- t.integer "destiny_id"
- t.date "transfer_date", null: false
- t.integer "user_id"
- t.integer "status", default: 1, null: false
- t.integer "received_by_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.text "observations"
- t.date "reception_date"
- t.integer "origin_is_pointsale", null: false
- t.integer "destiny_is_pointsale", null: false
- end
- add_index "transfers", ["destiny_id"], name: "index_transfers_on_destiny_id", using: :btree
- add_index "transfers", ["origin_id"], name: "index_transfers_on_origin_id", using: :btree
- add_index "transfers", ["received_by_id"], name: "index_transfers_on_received_by_id", using: :btree
- add_index "transfers", ["user_id"], name: "index_transfers_on_user_id", using: :btree
- create_table "units", force: :cascade do |t|
- t.string "unit"
- t.integer "status"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
- create_table "users", force: :cascade do |t|
- t.string "userid", default: "", null: false
- t.string "first_name", default: "", null: false
- t.string "last_name", default: "", null: false
- t.string "usertype", default: "", null: false
- t.string "email", default: "", null: false
- t.string "encrypted_password", default: "", null: false
- t.string "reset_password_token"
- t.datetime "reset_password_sent_at"
- t.datetime "remember_created_at"
- t.integer "sign_in_count", default: 0, null: false
- t.datetime "current_sign_in_at"
- t.datetime "last_sign_in_at"
- t.inet "current_sign_in_ip"
- t.inet "last_sign_in_ip"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "pointsale_id"
- t.string "unique_session_id", limit: 20
- t.integer "status", default: 1, null: false
- t.integer "warehouse_id"
- end
- add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
- add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
- add_index "users", ["userid"], name: "index_users_on_userid", unique: true, using: :btree
- create_table "warehouse_stocks", force: :cascade do |t|
- t.integer "warehouse_id"
- t.integer "product_id"
- t.decimal "stock_min", default: 0.0
- t.decimal "stock_max", default: 0.0
- t.decimal "stock", default: 0.0
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
- add_index "warehouse_stocks", ["product_id"], name: "index_warehouse_stocks_on_product_id", using: :btree
- add_index "warehouse_stocks", ["warehouse_id"], name: "index_warehouse_stocks_on_warehouse_id", using: :btree
- create_table "warehouses", force: :cascade do |t|
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.string "name"
- t.integer "status", default: 1, null: false
- t.string "prefix", null: false
- end
- add_foreign_key "suppliers", "contacts"
- end
|