
    Yg                        d dl mZmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
mZmZ  eddg      Zej                  d	       ee      fd
edefd       Zej                  d       ee      fd
edefd       Zej                  d       ee      fd
edefd       Zej                  d       ee      fde
defd       Zej                  d       ee      fdedefd       Zej'                  d       ee      fdededefd       Zy)    )	APIRouterDepends)get_db)Session)CollectionClass)StoreCollectionCollectionListCollectionSearchz/collectionsCollections)prefixtags/
collectiondbc                     t        |      j                  | j                  | j                  | j                  | j
                        }d|iS Nmessager   get_allbranch_office_id
cashier_id
added_datepager   r   datas      TC:\Users\jesus\OneDrive\Desktop\escritorio\newerp\app\backend\routers\collections.pyindexr      sM    2&&z'B'BJDYDY[e[p[pr|  sB  sB  CDt    z/detailc                     t        |      j                  | j                  | j                  | j                  | j
                        }d|iS r   r   get_all_with_detailr   r   r   r   r   s      r   detailr"      R    222:3N3NPZPePegqg|g|  I  N  N  ODtr   z/detail/searchc                     t        |      j                  | j                  | j                  | j                  | j
                        }d|iS r   r    r   s      r   r"   r"      r#   r   z/storestore_collectionc                 ^    | j                         }t        |      j                  |      }d|iS r   )dictr   store)r%   r   collection_inputsr   s       r   r(   r(      s2    (--/2$$%67Dtr   z/searchr)   c                     t        |      j                  | j                  | j                  | j                  | j
                        }d|iS r   r   )r)   r   r   s      r   searchr+   &   s[    2&&'8'I'IK\KgKgiz  jF  jF  HY  H^  H^  _Dtr   z6/total_collection/{branch_office_id}/{collection_date}r   collection_datec                 @    t        |      j                  | |      }d|iS r   )r   total_collection)r   r,   r   r   s       r   r.   r.   ,   s%    2//0@/RDtr   N)fastapir   r   app.backend.db.databaser   sqlalchemy.ormr   $app.backend.classes.collection_classr   app.backend.schemasr   r	   r
   collectionspostr   r"   r(   r+   getintstrr.    r   r   <module>r:      sk   & * " @ Q Q

 #4;FO n '  
 )5<V_ ~ 7  
 "#5<V_ ~ 7  $
 (;B6? O    )=DV_ - 7  
 IJOVW] c C W  Kr   