insert image alongwith with custom data via a frontend form

For Image uploads you can use wp_handle_upload(). Adding attachments can be done through wp_insert_attachment(). The association between attachment and your costing item can be achieved through update_post_meta(). Aside: Meta keys starting with an underscore _ are not showing up in WordPress UI.

You code could be looking like this:

<?php
$my_costing_id; /* contains the id of the corresponding item in your costing table */

// create attachment
$attachment_data = array(
    'post_title' => 'An Image', 
    'post_content' => 'An Image', 
    'post_status' => 'publish', 
    'post_mime_type' => 'image/jpeg', 
);
$attachment_id = wp_insert_attachment($attachment_data , 'path/to/uploaded/file.jpg' );

update_post_meta( $attachment_id , '_costing_id' , $my_costing_id );

To get the $costing_id corresponding to a known $attachment_id simply use get_post_meta. To get the $attachment_id of a corresponding $costing_id, you will need to write your own SQL query and pass it to $wpdb:

<?php
$attachment_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_value=%d AND meta_key=%s") , $costing_id , '_costing_id' );

Hope this helps,

regards j.