# Appt Visit Catg is being lost on new encntr

**URL:** <https://community.open-emr.org/t/appt-visit-catg-is-being-lost-on-new-encntr/6194>\
**Category:** OpenEMR Development\
**Created:** [March 2, 2012, 1:01am UTC](https://community.open-emr.org/t/appt-visit-catg-is-being-lost-on-new-encntr/6194 "2012-03-02T01:01:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [March 2, 2012, 1:01am UTC](https://community.open-emr.org/t/appt-visit-catg-is-being-lost-on-new-encntr/6194/1 "2012-03-02T01:01:03Z")

</div>

**[tmccormi](https://sourceforge.net/u/tmccormi/)** wrote on [Friday, March 02, 2012](https://sourceforge.net/p/openemr/discussion/202506/thread/7bcdb2b5/#578a):

&nbsp; - ID: 3496133 Last Update: Tracker Item Submitted ( tmccormi )  
Details:  
Step to recreate on 4.1.0 (and 4.1.1-dev)  
1) Create a new appt, selecting a visit catg that is NOT 'Office Visit", on a day that does not already have an encounter  
2) Open the Appt and change the status to '@arrived", a new encounter will be created  
3) Open the new encounter and selected edit - Observe the the Visit Catg is now “Office Visit” instead of what was selected in the appt.

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [March 2, 2012, 10:01pm UTC](https://community.open-emr.org/t/appt-visit-catg-is-being-lost-on-new-encntr/6194/2 "2012-03-02T22:01:20Z")

</div>

**[yehster](https://sourceforge.net/u/yehster/)** wrote on [Friday, March 02, 2012](https://sourceforge.net/p/openemr/discussion/202506/thread/7bcdb2b5/#3c7b):

The code which creates an encounter from the calendar simply ignores the pc\_catid.

```
            addForm($encounter, "New Patient Encounter",
                    sqlInsert("INSERT INTO form_encounter SET " .
                        "date = '$event_date', " .
                        "onset_date = '$event_date', " .
                        "reason = '" . formData("form_comments") . "', " .
                        "facility = '$facility', " .
                        // "facility_id = '$facility_id', " .
                        "facility_id = '" . (int)$_POST['facility'] . "', " .
                        "billing_facility = '" . (int)$_POST['billing_facility'] . "', " .
                        "provider_id = '" . (int)$_POST['form_provider'] . "', " .
                        "pid = '" . $_POST['form_pid'] . "', " .
                        "encounter = '$encounter'"
                    ),
                    "newpatient", $_POST['form_pid'], "1", "NOW()", $username
                );
```

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [March 3, 2012, 12:30am UTC](https://community.open-emr.org/t/appt-visit-catg-is-being-lost-on-new-encntr/6194/3 "2012-03-03T00:30:35Z")

</div>

**[tmccormi](https://sourceforge.net/u/tmccormi/)** wrote on [Saturday, March 03, 2012](https://sourceforge.net/p/openemr/discussion/202506/thread/7bcdb2b5/#15de):

Fixed and push to SF master …

d3d4dbc Catg from Appt passes to New Encounter when autocreate is on  
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; interface/main/calendar/add\_edit\_event.php

Tony

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [March 3, 2012, 12:36am UTC](https://community.open-emr.org/t/appt-visit-catg-is-being-lost-on-new-encntr/6194/4 "2012-03-03T00:36:54Z")

</div>

**[bradymiller](https://sourceforge.net/u/bradymiller/)** wrote on [Saturday, March 03, 2012](https://sourceforge.net/p/openemr/discussion/202506/thread/7bcdb2b5/#0bd5):

Nice,  
Will include this in the next patch.  
-brady
