Exemplo n.º 1
0
    def modify_other_information(self):
        time.sleep(2)
        self.driver.switch_to_default_content()
        self.driver.switch_to_frame(iframe_element)
        self.driver.switch_to_frame(iframe_reg_req_app)

        # Submission Source
        # self.dict_modify_other_information['moi_submission_source_no'] = Random().randint(a=1, b=3)
        Select(self.driver.find_element(by=By.ID, value=MOI_Submission_Source)).select_by_index(1)

        # reason
        self.dict_modify_other_information['moi_modification_reason'] = RandomData().itas_random_char_nine
        self.driver.find_element(by=By.ID, value=MOI_Modification_Reason).\
            send_keys(self.dict_modify_other_information['moi_modification_reason'])

        # 修改Magisterial District
        self.driver.find_element(by=By.ID, value=MOI_Magisterial_District).click()
        self.driver.find_element(by=By.CSS_SELECTOR, value=MOI_Magisterial_District_CSS).click()
        magisterial_district_edit_data = self.driver.find_element\
            (by=By.CSS_SELECTOR, value=MOI_Magisterial_District_Data_CSS).text
        self.dict_modify_other_information['MOI_Magisterial_District_Actual_Data'] = magisterial_district_edit_data

        # attachment
        attachment_click_function(driver=self.driver, direct_element=MOI_Attachment_CSS, *())

        print(self.dict_modify_other_information)
        # submit button
        boi_current_handle = self.driver.current_window_handle
        self.driver.find_element(by=By.ID, value=MOI_Submit_button).click()
        self.driver.switch_to_default_content()
        self.driver.find_element(by=By.CSS_SELECTOR, value=MOI_Submit_yes_button_CSS).click()
        self.driver.get_window_position(boi_current_handle)

        return self.dict_modify_other_information
Exemplo n.º 2
0
    def capture_write_off(self, tin='', journal_type=''):
        self.__change_default_iframe()
        self.driver.switch_to_frame(iframe_reg_req_app)
        if tin == '':
            raise AttributeError('capture_write_off tin is null')
        self._journal_comment_element(tin)

        # 1:Write-off Tax 2:Write-off Penalties 3:Write-off Interest 4:Write-off Tax and Penalties
        # 5.Write-off Tax and Interest 6:Write-off Penalties and Interest 7:Write-off All Debt
        if journal_type == '':
            select_journal_type_index = 1
        else:
            select_journal_type_index = int(journal_type)
        Select(self.driver.find_element(by=By.ID, value=TAC_Journal_Capture_Write_Off_Type)).\
            select_by_index(select_journal_type_index)
        Select(self.driver.find_element(by=By.ID, value=TAC_Journal_Capture_Write_Off_Reason)).\
            select_by_index(Random().randint(1, 6))
        # Add button
        self.driver.find_element(
            by=By.ID, value=TAC_Journal_Capture_BF_Add_button).click()
        time.sleep(1)
        attachment_click_function(
            driver=self.driver,
            direct_element=TAC_Journal_Capture_attachments,
            *[])
        self.driver.find_element(
            by=By.ID, value=TAC_Journal_Capture_Submit_button).click()
Exemplo n.º 3
0
 def return_process_screen(self):
     time.sleep(2)
     return_search_screen = self.driver.current_window_handle
     self.driver.switch_to_default_content()
     self.driver.switch_to_frame(iframe_element)
     attachment_click_function(self.driver, direct_element=Return_CheckBox_CSS, *())
     self.driver.find_element(by=By.ID, value=Return_Submit).click()
     time.sleep(2)
     self.driver.switch_to_window(return_search_screen)
Exemplo n.º 4
0
    def contact_information(self):
        time.sleep(3)
        data_list = []
        self.driver.switch_to_default_content()
        self.driver.switch_to_frame(iframe_element)
        self.driver.switch_to_frame(iframe_reg_req_app)

        # 清除原始数据
        self.driver.find_element(by=By.ID, value=Primary_Telephone_Second).clear()
        self.driver.find_element(by=By.ID, value=Primary_Telephone_Last).clear()
        self.driver.find_element(by=By.ID, value=Other_Telephone_Second).clear()
        self.driver.find_element(by=By.ID, value=Other_Telephone_Last).clear()
        self.driver.find_element(by=By.ID, value=Email_Address).clear()
        self.driver.find_element(by=By.ID, value=Fax_Fax2Email_Second).clear()
        self.driver.find_element(by=By.ID, value=Fax_Fax2Email_Last).clear()
        self.driver.find_element(by=By.ID, value=Cellphone_Second).clear()
        for i in range(6):
            data_list.append(RandomData().itas_random_int_four)
        data_list.append(RandomData().itas_random_int_eleven)
        data_list.append(str(RandomData().itas_random_int_nine) + '@ca-css.com')
        # 填写新数据
        self.driver.find_element(by=By.ID, value=Primary_Telephone_Second).send_keys(data_list[0])
        self.driver.find_element(by=By.ID, value=Primary_Telephone_Last).send_keys(data_list[1])
        self.driver.find_element(by=By.ID, value=Other_Telephone_Second).send_keys(data_list[2])
        self.driver.find_element(by=By.ID, value=Other_Telephone_Last).send_keys(data_list[3])
        self.driver.find_element(by=By.ID, value=Email_Address).send_keys(data_list[7])
        self.driver.find_element(by=By.ID, value=Fax_Fax2Email_Second).send_keys(data_list[4])
        self.driver.find_element(by=By.ID, value=Fax_Fax2Email_Last).send_keys(data_list[5])
        self.driver.find_element(by=By.ID, value=Cellphone_Second).send_keys(data_list[6])
        print(data_list)
        # Attachment
        attachment_click_function(driver=self.driver, direct_element=Contact_Information_Attachment_CSS, *[])

        # confirm button
        self.driver.find_element(by=By.ID, value=Contact_Information_Confirm_Button).click()
        self.driver.switch_to_default_content()
        self.driver.find_element(by=By.CSS_SELECTOR, value=Contact_Information_Yes_Button).click()
        return data_list
    def registration_request_search_capture(self, n):
        reg_request_search_handle = self.driver.current_window_handle
        self.driver.implicitly_wait(time_to_wait=10)
        first_name = RandomData().itas_random_char_nine
        second_name = RandomData().itas_random_char_nine
        # print('firstname:%s' % first_name)
        # print('secondname:%s' % second_name)
        taxpayer_name = first_name + ' ' + second_name
        self.driver.implicitly_wait(time_to_wait=10)
        # *Submission Source
        select_capture_submission_source = self.driver.find_element(
            by=By.ID, value=Capture_Submission_Source)
        Select(select_capture_submission_source).select_by_index(3)

        # *Taxpayer Category
        if 10 < n < 20:
            taxpayer_category_no = 1
        elif 20 < n <= 30:
            taxpayer_category_no = 2
        elif 30 < n < 40:
            taxpayer_category_no = 3
        elif 40 < n <= 50:
            taxpayer_category_no = 4
        else:
            raise AttributeError("Taxpayer Category 错误")
        select_taxpayer_category = self.driver.find_element(
            by=By.ID, value=Taxpayer_Category)
        Select(select_taxpayer_category).select_by_index(taxpayer_category_no)

        # Taxpayer Type
        taxpayer_type_no = None
        if 10 < n <= 20:
            taxpayer_type_no = n - 10 + 1
        elif 20 < n <= 30:
            taxpayer_type_no = n - 20 + 1
        elif 30 < n <= 40:
            taxpayer_type_no = n - 30 + 1
        elif 40 < n <= 50:
            taxpayer_type_no = n - 40 + 1
        self.driver.find_element(by=By.ID, value=Taxpayer_Type_input).click()
        self.driver.find_element(by=By.CSS_SELECTOR,
                                 value=Taxpayer_Type_CSS +
                                 str(taxpayer_type_no) + ')').click()

        # Magisterial District
        self.driver.find_element(by=By.ID,
                                 value=Magisterial_District_input).click()
        self.driver.find_element(by=By.CSS_SELECTOR,
                                 value=Magisterial_District_CSS).click()

        # *Activity Sector
        select_activity_sector = self.driver.find_element(
            by=By.ID, value=Activity_Sector)
        Select(select_activity_sector).select_by_index(2)

        # *Source of Income
        self.driver.find_element(by=By.ID,
                                 value=Source_of_Income_input).click()
        self.driver.implicitly_wait(time_to_wait=10)
        self.driver.find_element(by=By.CSS_SELECTOR,
                                 value=Source_of_Income_CSS).click()

        # Primary Telephone&Cellphone&Email Address
        self.driver.find_element(by=By.ID,
                                 value=Primary_Telephone_first).send_keys(
                                     RandomData().itas_random_int_four)
        self.driver.find_element(by=By.ID,
                                 value=Primary_Telephone_second).send_keys(
                                     RandomData().itas_random_int_four)
        self.driver.find_element(by=By.ID, value=Cellphone).send_keys(
            RandomData().itas_random_int_nine)
        self.driver.find_element(
            by=By.ID, value=Email_Address).send_keys('*****@*****.**')
        # self.driver.find_element(by=By.ID, value=Email_Address).send_keys(str(RandomData().itas_random_int_nine) +
        #                                                                   '@ca-css.com')

        # Other Telephone&Fax/Fax2Email
        self.driver.find_element(by=By.ID,
                                 value=Other_Telephone_first).send_keys(
                                     RandomData().itas_random_int_four)
        self.driver.find_element(by=By.ID,
                                 value=Other_Telephone_second).send_keys(
                                     RandomData().itas_random_int_four)
        self.driver.find_element(by=By.ID,
                                 value=Fax_Fax2Email_first).send_keys(
                                     RandomData().itas_random_int_four)
        self.driver.find_element(by=By.ID,
                                 value=Fax_Fax2Email_second).send_keys(
                                     RandomData().itas_random_int_six)

        # Postal Address
        self.driver.find_element(by=By.ID,
                                 value=Postal_Address_OpenButton).click()
        select_postal_address_first = self.driver.find_element(
            by=By.ID, value=Postal_Address_first)
        Select(select_postal_address_first).select_by_index(1)
        self.driver.find_element(by=By.ID,
                                 value=Postal_Address_second).send_keys(
                                     RandomData().itas_random_int_six)
        self.driver.find_element(by=By.ID, value=Postal_Suburb_Area).send_keys(
            RandomData().itas_random_char_six)
        self.driver.find_element(by=By.ID, value=Postal_City_Town).send_keys(
            RandomData().itas_random_char_six)
        self.driver.find_element(by=By.CSS_SELECTOR,
                                 value=Postal_Address_SaveButton_CSS).click()

        # Residential/Business Address
        self.driver.find_element(
            by=By.ID, value=Residential_Business_Address_OpenButton).click()
        self.driver.find_element(by=By.ID, value=Address_Line).send_keys(
            RandomData().itas_random_char_nine)
        self.driver.find_element(by=By.ID,
                                 value=Residential_Suburb_Area).send_keys(
                                     RandomData().itas_random_char_nine)
        self.driver.find_element(by=By.ID,
                                 value=Residential_City_Town).send_keys(
                                     RandomData().itas_random_char_nine)
        self.driver.find_element(
            by=By.CSS_SELECTOR,
            value=Residential_Business_Address_SaveButton).click()

        # individual information
        self.driver.find_element(by=By.ID,
                                 value=First_Names).send_keys(first_name)
        self.driver.find_element(by=By.ID,
                                 value=Surname).send_keys(second_name)
        while True:
            self.driver.find_element(by=By.ID, value=Date_of_Birth).clear()
            self.driver.find_element(
                by=By.ID, value=Date_of_Birth).send_keys('10-10-1980')
            data_of_brith_data_js = 'return document.getElementById("' + Date_of_Birth + '").value'
            print(data_of_brith_data_js)
            data_of_brith_data = self.driver.execute_script(
                data_of_brith_data_js)
            print(11, data_of_brith_data)
            if data_of_brith_data == '10-10-1980':
                break
        select_id_type = self.driver.find_element(by=By.ID, value=ID_Type)
        Select(select_id_type).select_by_index(1)
        self.driver.find_element(by=By.ID, value=ID_Number).send_keys(
            RandomData().itas_random_int_eleven)
        # self.driver.find_element(by=By.ID, value=Gender_Male).send_keys()
        # self.driver.find_element(by=By.ID, value=Gender_Female).send_keys()
        self.driver.find_element(by=By.ID, value=Marital_Status_input).click()
        self.driver.find_element(by=By.CSS_SELECTOR,
                                 value=Marital_Status_CSS).click()

        # bank Account
        self.driver.find_element(by=By.CSS_SELECTOR,
                                 value=bank_account_tab_CSS).click()
        self.driver.find_element(by=By.ID,
                                 value=Bank_account_NewButton).click()
        self.driver.implicitly_wait(time_to_wait=10)
        select_bank_name = self.driver.find_element(by=By.ID,
                                                    value=Name_of_Bank)
        Select(select_bank_name).select_by_index(2)
        select_branch_name = self.driver.find_element(by=By.ID,
                                                      value=Branch_Name)
        Select(select_branch_name).select_by_index(2)
        select_type_of_account = self.driver.find_element(
            by=By.ID, value=Type_of_Account)
        Select(select_type_of_account).select_by_index(3)
        self.driver.find_element(by=By.ID, value=Account_Number).send_keys(
            RandomData().itas_random_int_nine)

        # Tax Type ITX
        self.driver.find_element(by=By.CSS_SELECTOR,
                                 value=tax_type_tab_CSS).click()
        self.driver.implicitly_wait(time_to_wait=10)
        # control_effective_date = self.driver.find_element(by=By.ID, value=Effective_Date)
        self.driver.find_element(by=By.ID, value=Effective_Date).clear()
        self.driver.implicitly_wait(time_to_wait=10)
        effective_date_js = """
        document.getElementById("registeredTaxType[0].creg06EffectiveDate").removeAttribute('readonly')"""
        self.driver.execute_script(effective_date_js)
        self.driver.implicitly_wait(time_to_wait=10)
        # print(currentDay)
        self.driver.find_element(
            by=By.ID,
            value=Effective_Date).send_keys(income_tax_effective_date)

        # Tax Type VAT
        self.driver.find_element(by=By.CSS_SELECTOR,
                                 value=VAT_Checkbox_CSS).click()
        effective_date_js_vat = """
        document.getElementById("registeredTaxType[1].creg06EffectiveDate").removeAttribute('readonly')"""
        self.driver.implicitly_wait(time_to_wait=10)
        # control_effective_date = self.driver.find_element(by=By.ID, value=Effective_Date)
        self.driver.find_element(by=By.ID, value=VAT_Effective_Date).clear()
        self.driver.implicitly_wait(time_to_wait=10)
        self.driver.execute_script(effective_date_js_vat)
        self.driver.implicitly_wait(time_to_wait=10)
        # print(currentDay)
        self.driver.find_element(
            by=By.ID,
            value=VAT_Effective_Date).send_keys(vat_tax_effective_date)
        self.driver.find_element(by=By.ID, value=VAT_Details_button).click()
        time.sleep(1)
        self.driver.switch_to_default_content()
        self.driver.switch_to_frame(iframe_element_vat_details)
        self.driver.find_element(by=By.ID, value=VAT_Estimated_Annual_Taxable_Supplies).\
            send_keys(RandomData().itas_random_int_nine)
        self.driver.switch_to_default_content()
        time.sleep(1)
        self.driver.find_element(by=By.CSS_SELECTOR,
                                 value=VAT_Details_Screen_Yes_button).click()

        # Other Business Activity
        self.driver.switch_to_frame(iframe_element)
        self.driver.find_element(by=By.ID,
                                 value=Other_Source_of_Income_tab).click()
        self.driver.implicitly_wait(time_to_wait=10)
        self.driver.find_element(
            by=By.ID, value=Other_Source_of_Income_NewButton).click()
        in_activity_sector_select = self.driver.find_element(
            by=By.ID, value=IN_Activity_Sector)
        Select(in_activity_sector_select).select_by_index(1)
        in_source_of_income_select = self.driver.find_element(
            by=By.ID, value=IN_Source_of_Income)
        Select(in_source_of_income_select).select_by_index(1)
        active_inactive_select = self.driver.find_element(
            by=By.ID, value=Active_Inactive)
        Select(active_inactive_select).select_by_index(1)

        # attachments
        attachment_click_function(
            driver=self.driver,
            direct_element=registration_request_search_capture_attachments,
            *[])
        # attachment_elements = self.driver.find_elements(
        #     by=By.CSS_SELECTOR, value=registration_request_search_capture_attachments)
        # for attachment_element in attachment_elements:
        #     attachment_element_status = attachment_element.is_selected()
        #     # print(attachment_element_status)
        #     if attachment_element_status is False:
        #         attachment_element.click()

        # submit button
        self.driver.find_element(by=By.ID, value=capture_submit_button).click()
        self.driver.switch_to_default_content()
        self.driver.find_element(by=By.CSS_SELECTOR,
                                 value=capture_yes_button_CSS).click()
        print(taxpayer_name)
        time.sleep(3)
        self.driver.switch_to_window(reg_request_search_handle)
        return taxpayer_name
Exemplo n.º 6
0
    def capture_miscellaneous_adjustment(self,
                                         tin,
                                         journal_type='',
                                         doc_no1=''):
        try:
            self.__change_default_iframe()
            self.driver.switch_to_frame(iframe_reg_req_app)
            self._journal_comment_element(tin)
            if journal_type == 'AR':
                Select(
                    self.driver.find_element(
                        by=By.ID, value=TAC_Journal_Capture_Journal_Type)
                ).select_by_value('AR')
                self.driver.find_element(
                    by=By.ID, value=TAC_Journal_Capture_Add_button).click()
                get_vat_doc_no = """select t.ctac03_document_num from ttac03_transaction t
                                    inner join treg01_taxpayer a
                                    on t.creg01_taxpayer_uid = a.creg01_taxpayer_uid and t.ctac03_cr_dr='Cr'
                                    and a.creg01_tin =""" + str(tin)
                doc_no = self.oracle.oracle_sql_execute_function(
                    get_vat_doc_no, response=1)
                time.sleep(2)
                self.driver.find_element(
                    by=By.ID,
                    value=TAC_Journal_Capture_AR_Doc_No_Text).send_keys(doc_no)
                self.driver.find_element(
                    by=By.ID,
                    value=TAC_Journal_Capture_AR_Search_button).click()
                time.sleep(1)
                adjust_receipt_get_payment_date = self.driver.find_element\
                    (by=By.CSS_SELECTOR,value=TAC_Journal_Capture_AR_Table_Data_CSS).text
                edit_date = date(adjust_receipt_get_payment_date)
                print(edit_date)
                self.driver.find_element(
                    by=By.CSS_SELECTOR,
                    value=TAC_Journal_Capture_AR_Table_Data_CSS).click()
                self.driver.find_element(
                    by=By.ID,
                    value=TAC_Journal_Capture_AR_Target_Issue_Date).clear()
                self.driver.find_element(
                    by=By.ID,
                    value=TAC_Journal_Capture_AR_Target_Issue_Date).send_keys(
                        edit_date)
                self.driver.find_element(
                    by=By.ID,
                    value=TAC_Journal_Capture_AR_Add_to_Journal_button).click(
                    )
                time.sleep(1)
            elif journal_type == 'AA':
                Select(
                    self.driver.find_element(
                        by=By.ID, value=TAC_Journal_Capture_Journal_Type)
                ).select_by_value('AA')
                self.driver.find_element(
                    by=By.ID, value=TAC_Journal_Capture_BF_Add_button).click()
                time.sleep(2)
                self.driver.find_element(
                    by=By.ID, value=TAC_Journal_Capture_RT_Doc_No_NO).click()
                Select(
                    self.driver.find_element(
                        by=By.ID, value=TAC_Journal_Capture_ARA_Tax_Type)
                ).select_by_value('1')
                Select(self.driver.find_element(by=By.ID, value=TAC_Journal_Capture_ARA_Liability_Type)).\
                    select_by_value('TAXLB')
                self.driver.find_element(
                    by=By.ID, value=TAC_Journal_Capture_ARA_Tax_Year).clear()
                self.driver.find_element(
                    by=By.ID,
                    value=TAC_Journal_Capture_RT_Search_button).click()
                time.sleep(2)
                original_amount = self.driver.find_element(
                    by=By.CSS_SELECTOR,
                    value=TAC_Journal_Capture_ARA_Table_Data_CSS + '10' +
                    ')').text
                change_amount = amount_change(original_amount, 5000)
                print(change_amount)
                self.driver.find_element(by=By.ID, value=TAC_Journal_Capture_ARA_Table_Data_Amount).\
                    send_keys(str(change_amount))
                self.driver.find_element(
                    by=By.ID,
                    value=TAC_Journal_Capture_AR_Add_to_Journal_button).click(
                    )
                time.sleep(1)

            elif journal_type == 'RT':
                Select(
                    self.driver.find_element(
                        by=By.ID, value=TAC_Journal_Capture_Journal_Type)
                ).select_by_value('RJ')
                self.driver.find_element(
                    by=By.ID, value=TAC_Journal_Capture_BF_Add_button).click()
                time.sleep(2)
                self.driver.find_element(
                    by=By.ID, value=TAC_Journal_Capture_RT_Doc_No_Yes).click()
                self.driver.find_element(
                    by=By.ID,
                    value=TAC_Journal_Capture_RT_Doc_No).send_keys(doc_no1)
                self.driver.find_element(
                    by=By.ID,
                    value=TAC_Journal_Capture_RT_Search_button).click()
                time.sleep(2)
                self.driver.find_element(
                    by=By.CSS_SELECTOR,
                    value=TAC_Journal_Capture_RT_CheckAll_CSS).click()
                self.driver.find_element(
                    by=By.ID,
                    value=TAC_Journal_Capture_RT_AddtoJournal_button).click()
                time.sleep(1)

            elif journal_type == 'ABFB':
                time.sleep(1)
                Select(
                    self.driver.find_element(
                        by=By.ID, value=TAC_Journal_Capture_Journal_Type)
                ).select_by_value('BF')
                Select(
                    self.driver.find_element(
                        by=By.ID, value=TAC_Journal_Capture_BF_Tax_Type)
                ).select_by_value('1')
                Select(
                    self.driver.find_element(
                        by=By.ID, value=TAC_Journal_Capture_BF_Liability_Type)
                ).select_by_value('TAXLB')
                self.driver.find_element(
                    by=By.ID, value=TAC_Journal_Capture_BF_Tax_Year).clear()
                self.driver.find_element(
                    by=By.ID,
                    value=TAC_Journal_Capture_BF_Tax_Year).send_keys('2019')
                self.driver.find_element(
                    by=By.ID,
                    value=TAC_Journal_Capture_BF_Liability_Type).click()
                time.sleep(1)
                Select(
                    self.driver.find_element(
                        by=By.ID, value=TAC_Journal_Capture_BF_Tax_Period)
                ).select_by_value('1')
                self.driver.find_element(
                    by=By.ID,
                    value=TAC_Journal_Capture_BF_Amount).send_keys('2019')
                self.driver.find_element(
                    by=By.ID, value=TAC_Journal_Capture_BF_Add_button).click()
            else:
                pass
            attachment_click_function(
                driver=self.driver,
                direct_element=TAC_Journal_Capture_attachments,
                *[])
            self.driver.find_element(
                by=By.ID, value=TAC_Journal_Capture_Submit_button).click()
            time.sleep(2)
        except Exception as err:
            print(err)
            self.driver.get_screenshot_as_file(
                file_picture + 'capture_miscellaneous_adjustment' +
                file_local_time + '.jpg')