
    ,h/
                     L    d dl mZ d dlmZmZ d dlmZ d dlmZ  G d d      Z	y)    )Session)DteModelCollectionModel)CashierClass)funcc                       e Zd ZdefdZd Zy)CustomerCollectionClassdbc                     || _         y )N)r
   )selfr
   s     bC:\Users\jesus\OneDrive\Desktop\escritorio\newerp\app\backend\classes\customer_collection_class.py__init__z CustomerCollectionClass.__init__   s	        c                    |j                   j                  d      }t        |d         }t        |d         }|dd|d}|j                   dz   }| j                  j	                  t
        j                  t        j                  t
        j                        j                  d      t        j                  t
        j                        j                  d            j                  t
        j                   |k(        j                  t
        j                  d	k(        j                  t
        j                        j!                         }|D ]1  }|j                  }t        |j"                        }	t%        | j                        j'                  |      }
| j                  j	                  t(              j                  t(        j                  |k(  t(        j*                  |
j                  k(  t(        j,                  |k(        j                         }|dkD  r| j                  j	                  t(              j                  t(        j                  |k(  t(        j*                  |
j                  k(  t(        j,                  |k(        j/                         }|	|_        |j2                  |_        ||_        | j                  j7                          | j                  j9                  |       t)               }||_        |
j                  |_        |	|_        |j2                  |_        ||_        ||_        | j                  j;                  |       | j                  j7                          | j                  j9                  |       4 y )
N-r      02d04dz-01total_amounttotal_tickets   )periodsplitintr
   queryr   branch_office_idr   sumtotallabelcountidfilter	status_idgroup_byallr   r   get_subscriber_cashierr   
cashier_id
added_datefirstsubscriber_amountr   updated_datecommitrefreshadd)r   	form_datar   yearmonthdateresultsresultr   r   subscriber_cashiercheck_existence
collections                r   storezCustomerCollectionClass.store
   s   !!'',6!9~F1I#;aSz*%' GGMM))(..~>

8;;'--o>
 VHOOv-.VH&&!+,Xh//0SU 	  "	,F%66v223L!-dgg!6!M!MN^!_"ggmmO<CC004DD**.@.C.CC**d2 eg	  "!WW]]?;BB#448HH#..2D2G2GG#..$6 %'	  0<
,+1+?+?
(*.
' 
+,.
.>
+(:(=(=
%/;
,+1+?+?
((,
%*.
'J' 
+E"	,r   N)__name__
__module____qualname__r   r   r8    r   r   r	   r	      s    7 5,r   r	   N)
sqlalchemy.ormr   app.backend.db.modelsr   r   !app.backend.classes.cashier_classr   
sqlalchemyr   r	   r<   r   r   <module>rA      s    " ; : 9, 9,r   